a) To my knowledge Domain Objects should for the most part be oblivious to technical aspects of a design. Since I view class inheritance as being a technical solution, wouldn’t introducing a Layer Supertype pattern into our domain corrupt it?
b) If you disagree, please elaborate why
Thanks
The idea behind the Layer Supertype pattern is that there might be attributes or methods that every object in the layer must have by virtue of being in that layer. Fowler uses the example of Domain Objects (in Patterns of Enterprise Architecture) all having an ID, which makes some sense–if you are a domain entity, you must have some sort of identity. So, the pattern is to extract those shared attributes into a super type, and then have all the classes in that layer extend that type.
This really isn’t a case of corrupting the domain model, in that we’re not adding anything “technical” to the domain objects–we are simply abstracting out the common attributes.
It’s a design pattern because people have found that it’s a useful thing to do.
1