如何在DDD中识别域?

发布于 2025-01-21 20:49:43 字数 2987 浏览 0 评论 0 原文

我想构建一个应用程序,我想将DDD规则应用于我的建筑设计。

我描述了我的应用程序:

在数据库中,我有表:报告 Notification 用户 event 公司,<代码>利益相关者,事务

该应用程序将需要身份验证,因此我会根据用户表进行身份验证。

在应用程序中,我需要在上面提到的数据库中的表上显示并进行CRUD操作。

他们每个人都有自己的应用程序中的页面。例如:

 /reports (create, delete, get one, get all, search, edit)
 /reports/:id 
 /notifications (create, delete, get one, get all, search, edit)
 /notifications/:id 
 /events (create, delete, get one, get all, search, edit)
 ...

在报告表中我有: id 标题 lastupdate body 公司,<代码>事件。 每个报告都有公司清单和事件列表。用户可以编辑报告并更改 title body ,他还可以从列表中添加/删除公司,因此转到事件

const reports = [
{ id, title, body, companies: [{ id, name, ... }], events: [{ id, ...}]}
]

我还想拥有以下单独的页面:公司 event 利益相关者显示它们的列表(公司拥有自己的页面,事件有自己的页面..)为了添加/编辑/删除每个实体。

交易项目应属于利益相关者。我的意思是,每个利益相关者都有许多交易。同样的地方也在这里:我想 add/edit/delete 每个事务。

 stakeholders = [{ id, name, transactions: [{ id, ... }]}, ...]

**每个操作 add/edit/edit/delete/view 生活在自己的页面中。

-

因此,我决定在我的应用程序中命名域: 验证,报告,通知,事件,公司,利益相关者,利益相关者 - 转变。

这使我能够创建具有以下功能以下文件结构的功能的域:

 reports
  domain (the bl is here)
  feature-edit (use the domain)
  feature-view (use the domain)
  feature-list (use the domain)
  feature-search (use the domain)
 auth
  domain (the bl is here)
  feature-login (use the domain)
  feature-register (use the domain)
  feature-forgot-password (use the domain)
 notification:
  domain (the bl is here)
  feature-create-new (use the domain)
  feature-remove (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
 company:
  domain (the bl is here)
  feature-create (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
  feature-view (use the domain)
  feature-search (use the domain)
 event:
  domain (the bl is here)
  feature-create (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
  feature-view (use the domain)
  feature-search (use the domain)
 stakeholder:
  domain (the bl is here)
  feature-create (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
  feature-view (use the domain)
  feature-search (use the domain)
 stakeholder-transaction:
  domain (the bl is here)
  feature-create (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
  feature-view (use the domain)
  feature-search (use the domain)

我正在考虑应用程序的每个部分的责任领域。但是它符合DDD域的要求吗?这些文件夹的分离是否符合DDD域的要求?由于某些东西不是最终的,因此应隔离域。但是有时我需要通知 Report 报告具有 Company 的创建。事件内部。

我非常感谢试图解决这一冲突的帮助

I want to build an application and I want to apply ddd rules to my architectural design.

I describe my application:

In the database I have tables: report, notification, user, event, company, stakeholder, transaction.

The application will need authentication so I do it against user table.

In the application I need to display and make a crud operation on the tables in the database I was mention above.

And each of them have it's own page in my application. for example:

 /reports (create, delete, get one, get all, search, edit)
 /reports/:id 
 /notifications (create, delete, get one, get all, search, edit)
 /notifications/:id 
 /events (create, delete, get one, get all, search, edit)
 ...

In the report table I have: id, title, lastUpdate, body, company, event.
Each report have a list of companies and list of events. the user can edit the report and change the title and the body and he can also add/remove company from the list so goes to event.

const reports = [
{ id, title, body, companies: [{ id, name, ... }], events: [{ id, ...}]}
]

I also want to have separate pages for: company, event, stakeholder to display list of them (company has own page, event has own page..) in order to add/edit/delete each entity.

The transaction items should belong to stakeholder. I mean each stakeholder have many transactions. and same goes here: i want to add/edit/delete each transaction.

 stakeholders = [{ id, name, transactions: [{ id, ... }]}, ...]

** each operation add/edit/delete/view lives in it own page.

--

So I decide to named the domains in my application:
auth, report, notification, events, companies, stakeholder, stakeholder-transactions.

And this is lead me to create domains with features following this folder structure:

 reports
  domain (the bl is here)
  feature-edit (use the domain)
  feature-view (use the domain)
  feature-list (use the domain)
  feature-search (use the domain)
 auth
  domain (the bl is here)
  feature-login (use the domain)
  feature-register (use the domain)
  feature-forgot-password (use the domain)
 notification:
  domain (the bl is here)
  feature-create-new (use the domain)
  feature-remove (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
 company:
  domain (the bl is here)
  feature-create (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
  feature-view (use the domain)
  feature-search (use the domain)
 event:
  domain (the bl is here)
  feature-create (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
  feature-view (use the domain)
  feature-search (use the domain)
 stakeholder:
  domain (the bl is here)
  feature-create (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
  feature-view (use the domain)
  feature-search (use the domain)
 stakeholder-transaction:
  domain (the bl is here)
  feature-create (use the domain)
  feature-edit (use the domain)
  feature-list (use the domain)
  feature-view (use the domain)
  feature-search (use the domain)

I'm thinking about the area of responsibility of each parts of my application. but does it match the ddd domain requirements? the separation of those folder are matching the ddd domain requirements? because something is not end up, the domain should be isolated. but sometimes I'll need notification to create from the report and report is have a company and event inside.

I really appreciated the help in trying to resolve this conflict

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

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

发布评论

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

评论(2

月寒剑心 2025-01-28 20:49:43

它们不是“域”,而是模块,似乎还可以。

您描述了您的应用程序以“在数据库中我有表:”和“在数据库中的表上的表格上进行CRUD操作”开始,

因此似乎是数据库/表中心,CRUD应用程序,DDD似乎对此过大。

要检查DDD模块/有限上下文,您应该开始查看域的本质,而不是所需的表。

They are not "domains" but modules, and they seems ok.

You describe your application starting with "In the database I have tables:" and "In the application I need to display and make a crud operation on the tables in the database"

So seems to be database/tables centric, a CRUD application, DDD seems overkill for this.

To check the DDD modules/bounded context you should start looking at your domain for what it is, not for the tables you need.

走走停停 2025-01-28 20:49:43

在一个非常简单的句子中,我可以说域:是问题空间,它来自域专家。实际上,这是关于为什么创建此软件以及该软件将解决哪些核心问题的原因。另外,DDD植根于一种不关心哪些数据库的语言。

in a very simple sentence I can say domain: is problem space and it comes from a domain expert. in fact, it's about why this software is created and what core problems this software will address. also, DDD is rooted in a language not taking care about which kinda databases you have.

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