nhibernate - DDD: Should everything fit into either Entity or Value Object? -
I am trying to follow DDD, or at least my limited understanding.
However, there is a problem fitting some things in the DDD box.
Example: I have a user unit. This user unit is a reference to a UserPreferencesInfo object - this is only a class that has a bunch of properties in relation to user preferences. These properties are quite unrelated in addition to this fact, that they are all user preferences (such as an address VO, where all the attributes are meaningful).
The question is - what is this UserPreferencesInfo object? 1) Clearly this is not a unit (I'm just storing it as a fluent component in the nabbbernet (i.e. in the same DB table as the user unit).
2) Vo? I understand that the value object is considered irreversible (so that you can sharpen them, just make them new). It is fully understood when an address for the example example (the address properties make a meaningful 'whole'). But in the case of UserPreferencesInfo I do not think it makes sense. can be 100 properties (real) This object may have 20 possessions - whenever I need to change a property, why would I want to recreate the object again?
I think I need to break the rules which I want, but I really do not like that idea (it's a slippery slope!) Do I miss something here?
Thanks
Answer 1 practical one) < / P>
I have a big allegation of DDD, but do not force it. You already know that unchanging VOs add more than necessary work. DDD is designed to use complexity, but in this case management has very little complexity.
I simply treat UserPreferencesInfo
as as a unit , and give it reference related to user
Keep it as a component or make your choice in a different table.
The IMHO, the whole unit vs. VO debate can be presented, it is highly unlikely that at the time of 6 months, another developer will look at your code and say, " WTF! Is not using floating voices! What was he thinking !! "
Answer 2 (DDD purist)
Is
Service Level in return, and before you know it, you have made a super-engineer to solve a very simple problem ...
Comments
Post a Comment