UML Domain Modeling
Asked Answered
E

4

11

What is the difference between a domain model and a data model?

Evanevander answered 30/9, 2010 at 22:5 Comment(0)
K
10

A datamodel is a design model that only describes data and it's relations. The model contains entities, but they are described in terms of what data they own not how they act on this data or what their responsibilities are.

An domain model on the other hand, is a conceptual model used in analysis of a problem domain. It describes the domain in terms of entities that have relations, data and behaviour. It describes the responsibilities of those entities as relevant for understanding the problem domain.

BTW an excelent and very short introduction to UML is:

UML Distilled: A Brief Guide to the Standard Object Modeling Language

Kristynkrock answered 30/9, 2010 at 22:15 Comment(3)
A Data Model can exist at Conceptual, Logical and Physical levels. I consider the Conceptual Data Model to be a subset of the Domain Model and it may be the same thing (isomorphic?) in some methodologies.Lambrequin
+1 @MikeAinOz. Equally, a Domain Model needn't just be conceptual. The core principle in Domain Driven Design is that a real, live, fully executing Domain Model is the centrepiece of the solution.Provinciality
+1 Was what I was going to say. I alway relate Data Model to physical and Domain to describe the problem area at an observable level (i.e., how the user see's the application in terms of items they interact with, etc).Nygaard
S
3

A data model is focused on the DB schema definition, including tables, columns, and relationships.

A domain model is focused on the business domain, including concepts (classes of objects), behavior (methods/logic), and relationships.

In both cases, the cardinality is used for relationships (e.g. 1:1, 1:Many, 0:Many, ...).

That said, you would ideally like the data model and domain model to be closely related, i.e. a Person with name, ... and a MailingAddress, ... relates to a PERSON table with a NAME column and a FK to a MAILING_ADDR table entry. You have to decide where logic is hosted - in the objects in the software system vs. in the DB via procedures, triggers, and such.

Switchback answered 1/10, 2010 at 18:40 Comment(1)
I fully agree with this post. My answer was dealing with an implementation trick that I use in my company. We also use this approach because we have hibernate specialists. If we didn't have this expertize I am not sure we will do the same top down modeling to database approach.Lombardy
A
0

I think it's important to provide some clarity here for posterity.

A data model is a design for how to structure and represent information. By structure, I mean concerns like "fifth normal form". By representation, I mean choosing a computer serialization, such as integer, floating point, or string.

The term domain model actually has two conflated meanings.

  • A model of essential characteristics of real or imaginary things in the world. In this kind of model, classes represent human conceptualizations and instances are things in the world. For example, a "Person" class would have instances including you and me, and an essential characteristic might be that every Person has a mother. This kind of model is often called an conceptual ontology or concept model and is intended to provide meaning.
  • A model of required information about things in the world, usually with some system in mind. In this kind of model, classes represent information that must be stored about things in the world. For example, a "Person" class would have instances representing required information about you and me, such as first name, last name, date of birth, current height, and current weight. This information often does not include all essential characteristics, such as our mothers, because, for the purposes of a particular system, that information is not required. This kind of model is often called an information model, conceptual data model, or operational ontology.

Both the UML and OWL languages can be used to represent either kind of domain model. Both can be considered analysis models, as they are used to analyze a domain. One is used to understand things in a domain, the other is used to gather requirements to build a particular software or database system for things in a domain. Both are necessary, and, unfortunately, they are usually conflated such that people building an analysis model are themselves confused about what they are modeling!

Airport answered 19/3, 2016 at 17:10 Comment(0)
L
-1

I think that domain model and data model are now pretty much the same with new top down modelling technologies. I mean that you can model in a class diagram and only add database stereotypes in your diagram. If you use the tool that I use then your ejb3 annotation would be immediately synchronized with your code. The next step is only to use a mapper to create your database. This technology only works with Java

Lombardy answered 1/10, 2010 at 12:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.