UML Domain Modeling

后端 未结 4 2187
醉梦人生
醉梦人生 2021-02-08 14:20

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

相关标签:
4条回答
  • 2021-02-08 15:06

    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

    0 讨论(0)
  • 2021-02-08 15:07

    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

    0 讨论(0)
  • 2021-02-08 15:08

    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.

    0 讨论(0)
  • 2021-02-08 15:11

    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!

    0 讨论(0)
提交回复
热议问题