Share via


Domain Models versus Models

A domain-specific language is defined by its domain model. The domain model includes the domain classes and domain relationships that form the basis of the domain-specific language. The domain model is not the same as a model. The domain model is the design-time representation of the domain-specific language, while the model is the run-time instantiation of the domain-specific language.

Domain classes are used to create the various elements in the domain, and domain relationships are the links between the elements. They are the design-time representation of the elements and links that will be instantiated by the users of the design-specific language when they create their models.

The following illustration shows part of the domain model of the Family Tree sample.

Family Tree Model

The illustration shows two Person domain classes plus a ParentRelation domain relationship. One of the roles in this relationship is Parent, which has a multiplicity of 0...* (which means that a parent may have any number of children or no children). The other role is Child, which also has a multiplicity of 0...* (which means that a child may have any number of parents or no parents). The Person domain class has two domain properties, Birth and Death, which are both integers. These properties are used to display the birth and death years on the Person element.

Note

There are only four multiplicities (0...*, 1...*, 1...1, and 0...1), but you can further restrict the occurrences of a given element by using constraints.

When you compile the Family Tree sample project and run it in Visual Studio, you can create a Family Tree model. The following illustration shows part of a Family Tree model of the Tudor family.

Tudor Family Tree Model

The illustration shows three instances of the Person domain class, Henry, Mary, and Elizabeth. Henry has a ParentRelation relationship with both Mary and Elizabeth. Henry has a Birth property of 1491 and a Death property of 1547.

See Also

Other Resources

Domain-Specific Language Tools Glossary

Change History

Date

History

Reason

July 2008

Rewrote and refactored project

Content bug fix.