什么是领域模型

发布于 2024-08-14 01:52:22 字数 100 浏览 2 评论 0 原文

我已经阅读了域模型的维基百科定义。我还是不明白。我读过很多关于 NHibernate 的文章,几乎在我读到的每一篇文章中我都会看到术语“领域模型”。它到底是什么?有人有领域模型的示例吗?

I have read the wikipedia definition of a domain model. I still don't get it. I have been reading alot of posts for NHibernate and almost in every post I read I see the term Domain Model. What exactly is it and does any one have an example of a domain model.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

洒一地阳光 2024-08-21 01:52:22

基本上,它是您的业务目的所需的对象的“模型”。

假设您正在制作一个销售跟踪网站 - 您可能有诸如客户、供应商、交易等类。整个类集以及它们之间的关系将构成您的 域模型

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.

三生殊途 2024-08-21 01:52:22

领域模型是领域中真实情况对象的可视化表示。
域是一个值得关注的领域。它用于指代您正在处理的区域。
模型是一个图,对于领域模型,主要使用类图 UML。类图仅用于表示法。
术语“域模型”并不意味着一组描述软件类的图表。

因此,例如想象一家商店。对于该商店,您想要构建一个全新的销售点系统(我们称之为 POS 系统)。 POS 系统是一种用于记录销售和处理付款的计算机化应用程序。因此您重点关注 POS 系统领域。
现在您将概念化将用于该系统的对象。
所以你会得到诸如:销售、付款、注册、项目等对象。
在域模型中,您可以对这些对象进行建模并绘制它们之间的关联,以便您对系统如何工作有一个高层次的了解。
POS 域模型的示例如下:

在此处输入图像描述

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

孤千羽 2024-08-21 01:52:22

如果您要将程序去掉 GUI 和 DBMS,并将其替换为命令行界面和 MySQL 服务器实例,然后将整个程序移植到具有不同系统调用和文件系统访问 api 调用的不同平台,在此过程中您没有更改的部分是领域模型。

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.

浮萍、无处依 2024-08-21 01:52:22

本文可能会有所帮助:

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

基本思想是,域是问题域,而模型是......好吧,它的模型。上面的文章比我说的更雄辩,如果你想深入了解,还有很多其他资源。

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.

知你几分 2024-08-21 01:52:22

从 Eric Evans 的《领域驱动设计:解决软件核心的复杂性》一书的角度回答:

[域]模型是一个抽象系统,描述域的选定方面,可用于解决与该域相关的问题。

实际上它的意思如下。根据输入,我们有领域专家、领域知识源和软件产品的需求。 建模意味着引出该领域知识的相关[对于正在开发的软件]部分并以某种方式表示它。如果我对作者的理解正确的话,该模型可以用多种方式表示:作为文本、作为图表、作为代码、以口头交流的形式。该模型与迭代软件开发并行更新,并根据软件开发的需要进行重新设计。

因此,领域模型是与给定软件开发项目相关的领域知识的选择性和结构化表示。

Answering from perspective of Eric Evans's "Domain-Driven Design: Tackling Complexity in the Heart of Software" book:

[A domain] model is a system of abstractions that describes selected aspects of a domain and can be used to solve problems related to that domain.

Practically it means the following. On the input we have domain experts, domain knowledge sources and requirement for a software product. Modeling would mean eliciting the relevant [for the software under the development] part of that domain knowledge and representing it somehow. If I understood the author correctly, the model can be represented in many ways: as a text, as diagrams, as a code, in form of oral communication. The model is updated in parallel with iterative software development, being reworked for the need of the software development.

So a domain model is a selective and structured representation of domain knowledge relevant for a given software development project.

萌辣 2024-08-21 01:52:22

领域模型是精确建模一个特定业务领域的构造的集合。简单地说,它是实体、枚举、值对象、异常/自定义异常、接口、服务等的集合。所有这些都代表了领域模型。对描述业务领域有任何影响的任何内容。另一方面,任何不参与此描述的构造; UI代码、基础设施相关代码、持久化对象、各种工具等;在 DDD 背景下被视为第三方/外部关注点。

查看这篇短文

https://fiseni.com/posts/what-是域模型/

Domain model is a collection of constructs that accurately models one particular business domain. Simply put, it’s a collection of entities, enumerations, value objects, exceptions/custom exceptions, interfaces, services, etc. All of that represents the domain model. Anything that has any impact in describing the business domain. On the other hand, any construct that doesn’t take part in this description; the UI code, infrastructure related code, persistence objects, various tools, etc; are considered as third-party/outer concerns in the context of DDD.

Check out this short article

https://fiseni.com/posts/what-is-a-domain-model/

浅忆流年 2024-08-21 01:52:22

我可以用一个超级简单的句子说:

领域模型是领域的抽象,表示为代码
实现是一种视图,而不是业务用例的现实。

in a super simple sentence I can say:

Domain model is an abstraction of domain, expressed as code
implementation which is a view not reality of business use case.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文