领域模型和契约

发布于 2024-09-06 00:00:43 字数 734 浏览 1 评论 0原文

我正在为 DVD 租赁店建模:

  1. 客户端 将其 clientNumber 提供给系统
  2. System 会检查给定的 clientNumber 是否有效。
  3. 客户给出他想要租用的DVD的名称。
  4. ...
  5. ...稍后我必须在 Rent DVD 类概念的新实例与当前 Client c 之间形成关联。

我的领域模型是这样的: 替代文本

我为第一个和第二个操作制定了合同:

先决条件:无

后置条件:存在一个Client c,使得c.clientNumber = clientNumber

现在,我不知道是否应该在这个 Client c 和 DVDStore(我打算用作前端)之间建立关联。如果我不进行关联,我以后如何能够“引用”同一个客户端?我应该在客户和不同的概念之间建立关联吗?

谢谢

I am modelling a DVD Rental Store:

  1. A Client gives its clientNumber to the System.
  2. The System checks whenever the given clientNumber is valid.
  3. The Client gives the name of the DVD he wants to rent.
  4. ...
  5. ...I will later have to form an association between a new instance of Rent DVD class concept to the current Client c.

My Domain Model is something like:
alt text

I've made the Contract for the first and second operations as:

Preconditions: none

Postconditions: there exists a Client c such that c.clientNumber = clientNumber.

Now, I don't know if I should form an association between this Client c and the DVDStore(that I intend to use as front-end). If I don't make the association, how will I later be able to "reference" this same Client? Should I be making an association between Client and a different concept?

Thanks

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

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

发布评论

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

评论(1

泪痕残 2024-09-13 00:00:44

是的,必须在客户端和 DVDStore 之间创建关联。否则(如上所述),您以后将无法引用同一个客户端(至少无需再次搜索它!)。

Yes, one has to create an association between Client and DVDStore. Otherwise (as stated), you can't later refer to the same Client (at least without having to search for it... again!).

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