This question is an agnostic of the language, but I'm a C # guy, so I use the term POCO to refer to an object that only stores data, usually using the getter and setter fields.
I just redesigned my domain model to be the POCO super-duper, and I left a couple of problems on how to ensure that property values make sense in the domain.
For example, the EndDate of a service must not exceed the EndDate of the contract in which the Service resides. However, it seems that the SOLID violation put the check in set.EndDate setter, not to mention the fact that as the number of checks to be performed grows, my POCO classes will become cluttered.
I have some solutions (post in the answers), but they have their drawbacks, and I wonder which ones are favorite approaches to solving this dilemma?
language-agnostic design solid-principles separation-of-concerns modular-design
George mauer
source share