I have an Entity type, let's say Car for example. There is a Value Object type Tire for it. Each car has a set of tires with certain properties. Sometimes tires are replaced, which is communicated by a Bounded Context via Domain Events. There are some other BCs that record a Read Model of the cars and tires.
Now there is a new requirement. In the future, a BC should measure the tire pressure for each tire and display it to the user (i.e. also store it). This property is not interesting for the rest of the system, so there is no change to the Domain Events.
So the tires are Value Objects so far, but at a single point, the identity (not global, but per car) becomes relevant after all. I now see the following options:
- Make Tire an Entity type. So the BC that generates the tire change Domain Events has to come up with an ID and communicate it to the entire system, even though it is not relevant to it and almost anyone else.
- The tire pressure BC identifies the tires by their position in the car's tire list (which in the Read Model is derived from the Domain Events). Let's assume this is technically possible in my particular case.
Variant 1 would be very robust, but a small detail of a BC is extended to the whole system. Variant 2 could be realized as an implementation detail of the single BC, but it feels wrong somehow. It would work currently, as I said, but I'm concerned that I'll always have to keep an eye on it to make sure it continues to always work in the future since something like a tire order doesn't exist explicitly in the Domain Events model.
I suspect it's a lot like banknotes. For 99% it's a Value Object, but there's still a serial number on every note, which is usually ignored. Ignoring doesn't work that well in the software, because technically you have to deal with entities differently than with value objects, but you can't avoid that completely.
What do you think about this? Is it a general principle, that if the identity of something is relevant in any place, you have to use an Entity everywhere up the chain?