Model in Domain Driven Design

2 minute read

Model in Domain Driven Design is a system of abstraction that eliminates things which are not required. Domain Model allows us to think about a particular domain in a particular way.

In Domain Driven Design (DDD) philosophy, Model is a conceptual system and a system of abstraction.

In my previous article Philosophy of Domain Driven Design we have seen how one can apply strategic pattern of DDD and draw boundaries within a system. Among those boundaries, together business and Development team can decide which subdomain is most competitive and has core business values there only you will apply Domain Driven Design and find out Models.

You will learn

In this article, you will learn

  • What is Domain ?
  • What is a Model in Domain Driven Design ?
  • What are the characteristics of a Good Model ?
  • How to do Modeling ?
  • What are the benefits of Model ?

Lets Begin with definition of Domain and Model in Domain Driven Design (DDD) philosophy.

What is Domain ?

what is domain.png

Domain is a sphere of knowledge or activity.

Example of domain in real world could be Content Management, Tourism, Education, Banking, Cargo Shipping, Insurance etc. If you are working on a software project for a client who is in Education field. They create software for students to give online exam etc. Then Your Problem Domain is about Education. Like I said Domain is a sphere of knowledge hence Education Domain is that sphere here. Imagine Google Earth how it looks like a sphere :)

What is Model ?

Man's Portrait Photo

Model is a system of abstraction representing  selected aspects of a domain.

As we know Domain is always full of lots of information and it has real world problems. Therefore, its a general tendency to start thinking model as Real World Model. However, We do not want to model the real thing, that is not a Model. Model itself is just a concept, a system of abstraction.

Model is an answer to a question related to a difficult problem in Domain which we want to solve by software. Domain has huge and overwhelming amount of information sometimes very messy information available. Using Model, we help to shift apart that data to find the part of the data that actually relevant to answering our difficult question. Once you found the data needed to answer then transform them into a form that makes that answer more clear and even simpler.

Hence Model Addresses a subset of information about the domain. Model is Specialized rather than generalize. Models are artificial not real and it evolves over the time.

Characteristics of Good Model

core values

Although model is never perfect, it evolves and the old model always becomes useless. Therefore, we should define the characteristics of a good model.

  • Model should focus only on relevant information and exclude other information.
  • Model formalizes our thinking. Sometimes by drawing upon pre existing bodies of thoughts, sometimes we have to invent new things etc.
  • Model should make assertions about the result. This allows us to confidently say what will happen if the artifact is used in a certain way. Example in Google Map important assertion is when we drive on given direction car should reach at destination. It should not take to some other place.

 

Comments