Domain-Driven Design, I'm trying to figure out what the difference some kind of mathematically and not intuitively. In my current project, we have some kind of payment
transfers between banks
.
In this system, the bank is carried not like a physical building but an abstract bank
. It has BankCode
for sure, country
and Bank Name
. And the question is: Is the bank should be an entity or value object
. I intuitively feel that it should be entity, but some people say that it could be like a value object.
As I know, entities
MIGHT have the same attributes but still be different. On the other hand, value objects
must not have an identity
, they should be the same in case all attributes are the same, they should answer what they are, not who or which they are. Please If I'm wrong - correct me.
In the system, banks
are not changing during any flow, like another Value object Country
or Currency
, probably we could say, that banks with the same bank code, name, and country are the same banks. As well as we can say that Country
with the same country code (ISO format) is the same. But still, for me, I feel like they are entities. Could someone prove where I'm wrong, and give mathematic proofs that they should be either Value
object or Entities
.
Currently, I end up with that: "The one difference between Entity and Value Object is the entity can contain the all same attributes and still be different, the Value Object can't
", like transaction and people can have same amounts and goods, same names, but still be different, and like address should be the same if the country, city, and house number are the same. Please correct me, and maybe there are more differences