Reputation: 12833
One universal data model author I am reading contends that in his experience, 50% of all enterprise systems are 'universal' in their need to deal with Parties, Work Efforts, etc, 25% is universal within that business' industry, with the balance being unique to a given business (ie, Coke v Pepsi).
But I am not aware of code that builds on this, and can't think of anyone really looking at patterns from a domain perspective, as opposed to a data modeling one, since Fowler did so in the mid 90's.
Does anyone with a DDD orientation have any opinion based experience as to the usefulness of universal data models?
Do you literally have sub types of Party limited to Person and Organization, with everyone else in Roles? How do you implement that if so?
Any implementation guidelines or open source systems that you like?
Cheers,
Berryl
Upvotes: 1
Views: 2005
Reputation: 95582
Do you literally have sub types of Party limited to Person and Organization, with everyone else in Roles? How do you implement that if so?
For one minimal implementation, see this SO answer.
The short story is that a particular role (which might not be the best word) references the supertype if it's a role that can be filled by both individuals and organizations. "Customer" is probably a good example.
A particular role references the personal subtype if it can only be filled by a person. "Staff" or "Employee" might be a good example.
And a particular role references the organizational subtype if it can only be filled by an organization. "Employer" or "Former employer" might be a good example.
(Not all those examples are in the linked answer, but I think the PostgreSQL source code makes it pretty easy to figure out what you might need to do.)
Upvotes: 1
Reputation: 37719
The data and domain models presented in the Universal Patterns books and Fowlers Analysis Patterns are useful in that they provide a detailed and generalized overview of the structure of the models. I used them as a reference when creating more specific domain models and normally only use part of the model described in the books.
As far as the accountability patterns from Fowler's book, a Party is a different thing from a Role in that a given party may fulfill multiple roles. So to me it does make sense that a Party can either be a Person or an Organization. An example from the .NET framework is the IIdentity and IPrincipal interfaces. The IIdentity can represent a party whereas an IPrincipal is a combination of an identity and a set of roles.
Upvotes: 3