After reading Ayende’s recent blog post it got me thinking about a situation I regularly find myself in when building systems. Whilst Ayende’s post mentions that he’s not really interested in whether a child is responsible for creating itself or whether a parent is responsible for creating a child, I personally always favour the later.
However, whilst some objects within a domain model have an obvious parent that is also within the domain model some simply don’t. In these situations the question about who is the responsible party is slightly more confusing as whilst (as a child object) I know I’m not the responsible party for something I don’t really have anyone who is.
In these situations I create a notional “parent” for these orphans. I call this object the “System” or “Mother” object as the only reason it exists is to act as parent for objects who have no notional parent.
So who is the responsible party when nobody loves me? Simple, someone always loves you! :-)