是“域对象”吗?有代表业务规则的类吗?

发布于 2024-08-02 18:47:01 字数 155 浏览 6 评论 0原文

我遇到了“域对象”这个术语,并在 Google 上找到了几个定义,但我只是想验证我的理解是否正确。

这只是代表业务规则的任何类吗?因为“域”一词通常意味着特定于某些本地问题集的规则,例如如何计算所得税。

那么用于计算所得税的域对象将是您编写的代表所有税收规则的类?

I came across the term "domain object" and found a couple of definitions on Google but I just want to verify that my understanding is correct.

Is this simply any class that represents business rules - since the word 'domain' usually means rules that are specific to some local problem set such as how to calculate income taxes.

So the domain objects for calculating income taxes would be the classes that you write to represent all of the tax rules?

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

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

发布评论

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

评论(2

巨坚强 2024-08-09 18:47:01

这将是一个域服务域对象类似于收入纳税人。该对象可能具有一个Taxes属性,该属性调用域服务来根据例如规则计算应缴税款金额。

That would be a Domain Service. A Domain Object would be something like Income or TaxPayer. That object could have a Taxes property that calls the Domain Service to calculate the amount of taxes due according to the rules for example.

青瓷清茶倾城歌 2024-08-09 18:47:01

域对象是代表业务域中给定实体的任何对象。这有好几种口味。然而,一般来说,领域对象保存正在建模的实体的数据和任何规则。有些人选择在物理上分离这些问题,以便业务规则不会与数据在同一对象中进行处理。无论您选择什么实现,域对象都会以模块化方式对数据和规则进行逻辑分组。

A domain object is any object that represents a given entity in your business domain. There are several flavors of this. Generally speaking however domain objects hold data and any rules for the eitity that is being modeled. Some choose to phisically seperate these concerns so that the business rules are not processes in the same object as the data. Whatever implementation you choose domain objects logically group data and rules in a modular way.

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