| Newsgroups |
gmane.comp.programming.domain-driven-design |
| Message-ID |
<[email protected]> |
I have an entity similar to Product. It has many properties/attributes like Name, Description, few different prices like Original Price, Sales Price, Discounted Price, Cost, Manufacturer etc... Counting all the properties of this Entity that I use, it has 20 properties. To be agile, I see that this Entity can grow by adding new properties.
I'm sure I'm not modelling this Entity properly. I should have all pricing properties as Value objects. And move some properties to a different entity. However, I'm anticipating more properties are added which can ultimately change the version of the Entity. To put this way "Embrace change".
Is there a pattern to make an Entity agile, so a compilation is not needed for the Entity when a property/containing object is added and thus no deployment of the existing Entity is needed?
Is using a Key/Value pairs for this Entity a good practice?
Or use the inheritance with a hierarchy like ProductBase, ProductInfo (derived from ProductBase), ProductSpec1 (derived from ProductInfo), ProductSpec2 (derived from ProductSpec1)? By following this pattern, when a new property is added, I can create a new class called ProductSpec3 and derive from ProductSpec2 and deploy through a new assembly or DLL and don't touch the existing assemblies.
Thoughts?