3

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

4

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.

  • "It's a design pattern because people have found that it's a useful thing to do." <- This is design patterns described in a sentence. – Benjamin Oakes Feb 6 '14 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.