RE: Should look up tables be modeled as Value Objects or Entities?
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <[email protected]> |
Hi there! I'll say that status is probably a VO. Can two 'shipped' statuses be different from one another? The answer is probably not, i.e. you identify a status only according to its value/attribute(s). Also, you don't manage the life-cycle of a status, it has no meaning when it's not an attribute of the order. For these reasons, I would model status as a VO (and probably implement it as a simple enum), unless you have very unique business rules that deal with that status. One more thing, I wouldn't go and make the connection between the data model and the domain model. Saying something like "a look-up table is modeled as X in the domain model" is inherently invalid, since there isn't a 1-to-1 translation between the two. One can find various ways to implement the domain model or the data model for the same business domain. That is exactly why "Sometimes people model them as entities and sometimes as value objects" All the best, Moran