Domain model pattern

From CSSEMediaWiki
Jump to: navigation, search

The short definition for the Domain Model Pattern is: “an object model of the domain that incorporates both behavior and data”.

The domain model is created in an application by introducing a whole layer of objects which model the business concepts and entities that the application is working in. It creates a set of interconnected objects for dealing with the logic required by the business environment. An object-oriented domain model will be quite like the database model it uses, but domain model not only contains the data and also the process need to be used with the data.

There are two common ways of using domain model. One is to model each database table (or logic tables based on application requirement) as one class. Other design patterns and inheritance can also be used here. Another way is to introduce rich domain model which is good for complex domain logic, and as the result, the model will not look like the data model anymore. The Active record pattern can be used as the data mapper if the domain logic is not very complex; in the case of very complex domain logic, the Data mapper pattern should be used to map between the application and the data.

When to Use It

The Domain Model Pattern is best to be used by application with complex business logic and frequent changing business logic.

Personal tools