What is a Domain Model

If you were to take your program and strip away the gui and the DBMS, and replace it with a command line interface, and a MySQL server instance, then port the whole thing to a different platform with different system calls and file system access api calls, the part that you didn't change in that process is the domain model.


A domain model is a visual representation of real situation objects in a domain. A domain is an area of concern. Its used to refer to the area you are dealing with. The model is a diagram, for domain models the class diagram UML is mostly used. The class diagram is only used for the notation. The term domain model does not mean a set of diagrams describing software classes.

So for example imagine a store. For that store you want to build a brand new Point Of Sale system (lets call it POS system). A POS system is a computerized application used to record sale and handle payments. So you focus on the domain of the POS system. Now you will conceptualize the objects that will be used for this system. So you will get objects like: Sale, Payment, Register, Item etc. In a domain model you model these objects and draw associations between them so that you have an high level idea how this system will work. An example of the POS domain model will be like this:

enter image description here


This article might help:

https://dddcommunity.org/learning-ddd/what_is_ddd/

The basic idea is that the Domain is the problem domain and the model is... well the model of it. The above article is puts it far more eloquently than I would and there are plenty of other resources there if you want to go down the rabbit hole.


Basically, it's the "model" of the objects required for your business purposes.

Say you were making a sales tracking website - you'd potentially have classes such as Customer, Vendor, Transaction, etc. That entire set of classes, as well as the relationships between them, would consititute your Domain Model.