Domain Model and Object Model
Asked Answered
V

4

11
  • What is Domain Model?
  • What is 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.

Vituline answered 4/1, 2013 at 4:8 Comment(0)
H
9

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.

Hallowell answered 4/1, 2013 at 5:15 Comment(2)
thanks for your quick response.Can you suggest some books for beginners?Vituline
Here are some links which you can use for understanding these concepts: link1, link2, link3Hallowell
V
1

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

Vermination answered 17/10, 2018 at 14:8 Comment(0)
H
0

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.

Hyperpituitarism answered 4/1, 2013 at 4:43 Comment(2)
thanks for your quick response.Can you suggest some books for beginners?Vituline
I think this is a very constrained understanding, although this perspective is somewhat common. In reality, an object model is a very broad concept. For example, web browsers use an object model to represent documents (the DOM); the objects contained in it are not DTOs, and it's not a domain model.Luxe
I
0

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/

Inversion answered 1/9, 2020 at 18:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.