创建领域设计模型的最佳方法?

发布于 2024-12-23 05:18:34 字数 1436 浏览 1 评论 0原文

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

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

发布评论

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

评论(1

失去的东西太少 2024-12-30 05:18:34

作为一个开始,它看起来不错,但在您实际开始编码和测试初始域模型之前,我不会创建一个硬而快速的域模型,因为您可能会发现事情不太按预期工作,或者有些东西你错过了,或者要求改变了等等。

其他点快速浏览一下。

  • VisitBasic 的目的是什么,它应该是一个抽象基类还是更清晰的名称?
  • 您可能想让主机成为它自己的类,它可能包含与人员类不相关的信息,因此可能是人员的子类。但如上所述,迭代开发可能会更好。也可能是请求者,但可能性较小。

更新响应:
现在大多数事情的标准设计是添加一个服务层,即带有 createVisit 方法的 VisitService,并且访问对象上的属性应该仅链接到主机和请求者,而无需在其中包含任何业务逻辑。 (希望这能回答你的问题?)

It looks ok as a start, but I wouldn't make a hard and fast domain model until you have actually started coding and testing the initial domain model as you will probably find that things don't quite work as expected or there is something that you have missed, or the requirements change, etc.

Other points from a quick look.

  • What is the purpose of VisitBasic, should it be an abstract base class or the name made clearer?
  • You may want to make the host into it's own class, it may have information not relevant to the person class, so possibly a sub class of person. But as stated above it may be better to develop it iteratively. And possibly requester as well but probably less likely.

UPDATE RESPONSE:
The standard design now for most things is to add a service layer, i.e. VisitService with a createVisit method, and the properties on the visit object should just link to the host and requester without having any business logic in them. (Hope that answers your question?)

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