Tuesday, April 29, 2008

Domain Modelling

Domain modelling is a technique commonly leveraged by solution architects in order to build a conceptual model which describes the problem domain to be solved. A domain model is a static view of the problem domain, which describes the various relevant entities (such as customer, order, etc), their relationships, their major attributes and any relevant actions they perform in the context of the problem domain.

As such, a domain model is a visual representation of the vocabulary of a problem domain. A domain model does not assume that software is to be used as part of the solution. An example domain model is shown below.


The domain to be modelled is not restricted to a specific business problem to be solved. It may in fact simply be an area of the business (such as marketing or sales) we wish to model. In this context, the domain model is a single static viewpoint of an enterprise which visually describes the language used to describe the business from that perspective.

It is interesting to note the significance of perspective in domain modelling. One might think that in the real world a customer is a physical entity with a fixed set of attributes and actions he or she can perform, not open to interpretation. However we need to consider that a customer of one organisation is an employee of another.

As such, the same physical entity may have vastly different representations in different domain models. Perspective is everything, and we need to ensure that the perspective of a given domain model is sufficiently specific so that it does not become confused and overly complex.

In the context of SOA, each service will have its own domain model. We strive for high cohesion within a service domain model by ensuring that the described business area is highly specific, but loosely coupled with business areas supported by other services.

Eric Evans in his classic book Domain Driven Design provides considerable guidance on domain modelling and outlines many of the design patterns we may leverage in designing software systems centred around domain models. It is essential reading for those looking to design and develop custom built services.

It must be noted however that despite its many uses, domain modelling gives us only a static view of the business. We look to process mapping to provide a dynamic view that describes how entities interact over time. But more on that in my next post, so stay tuned!