vendredi 10 février 2017

DDD: Entity techniqully, but looks like value object?

At first let me describe a lit bit domain. We have a website, and there client can place an order. To place order, he must fill some data. This process is divided into steps. On each step he fills only some data. So when he will complete last step - all data, needed for order, is filled.

So we have an entity "StepsProgression". Inside there is an array of value objects "Step". They don't store anything, so they quiet simple and perfectly suits to be value objects. But in order, to persist user data across all steps, inside "StepsProgression" there is also an object "StepsSata".

And here comes the trouble. "StepsData" will have setters, to set user data. So it must be Entity. But from domain perspective it is not entity. It is Value object. Because i don't care about it's identity. I can replace it with object with the same data and it is ok.

What can you recommend in this situation?

Aucun commentaire:

Enregistrer un commentaire