领域模型和契约
我正在为 DVD 租赁店建模:
客户端
将其clientNumber
提供给系统
。System
会检查给定的clientNumber
是否有效。客户
给出他想要租用的DVD
的名称。- ...
- ...稍后我必须在
Rent DVD
类概念的新实例与当前Client c
之间形成关联。
我为第一个和第二个操作制定了合同:
先决条件:无
后置条件:存在一个Client c
,使得c.clientNumber = clientNumber
。
现在,我不知道是否应该在这个 Client c
和 DVDStore(我打算用作前端)之间建立关联。如果我不进行关联,我以后如何能够“引用”同一个客户端?我应该在客户和不同的概念之间建立关联吗?
谢谢
I am modelling a DVD Rental Store:
- A
Client
gives itsclientNumber
to theSystem
. - The
System
checks whenever the givenclientNumber
is valid. - The
Client
gives the name of theDVD
he wants to rent. - ...
- ...I will later have to form an association between a new instance of
Rent DVD
class concept to the currentClient c
.
My Domain Model is something like:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,必须在客户端和 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!).