Asish AP
Asish AP

Reputation: 4441

Domain Model and Object Model

Are Domain Model and Object Model the same thing? What is the difference between these two? Please explain with simple example. I'm new in this concepts. I searched a lot in Google. But I couldn't get any simple explanation and example.

Upvotes: 11

Views: 10678

Answers (4)

vivek borade
vivek borade

Reputation: 1

Domain Model => For me, a domain model is a separate thing from any particular code or piece of software. If I come up with a domain model for something to do with restaurants, I could express my domain model on a piece of paper if I wanted to (or just inside my head). My domain model is a standalone conceptual entity, regardless of whether I actually end up writing any software based on it or not. Object Model => The place where my domain model turns into actual code is in the object model. If my domain concepts include restaurant, order, and customer, then my object model will probably include objects like Restaurant, Order and Customer.

https://www.codewithjason.com/difference-domains-domain-models-object-models-domain-objects/

Upvotes: 0

A77
A77

Reputation: 172

If you talking about theses concepts according to DDD (Domain Driven Design), I don't agree with neigher of the preceding answers. As the author pointed out in his book,

A domain model does not have to be an object model. There are MODEL-DRIVEN DESIGNS implemented in Prolog, for example, with a model made up of logical rules and facts.

So a Domain Model is a representation of you domain rules based on any paradigm, not necessarly should it be Object, it could be any other paradigm, but the most important about it, is that it must make domain concepts and rules clear and separated from other technical aspects.

In conclusion, we can say that an Object Model is one of the representation forms of a Domain Model

Upvotes: 1

stamhaney
stamhaney

Reputation: 1314

An Object Model of a system is a collection of classes and objects describing the relationships between them and the properties and methods contained within, in terms of the Object Oriented principles : Abstraction, Encapsulation, Inheritance and Polymorphism.

A Domain Model is an Object Model describing the problem domain. They include the domain objects in the problem domain and describe the attributes, behavior and relationships between them.

Upvotes: 10

phnkha
phnkha

Reputation: 7872

According to my understanding, Object Model only about Data Transfer Objects, just a mirror of database records without behaviors.

Entities in Domain Model have both Data and Behaviors that mimic the business rule. Domain Model not only include Classes but also Interfaces which have no meaning in Object Model.

Upvotes: 0

Related Questions