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?)
发布评论
评论(1)
作为一个开始,它看起来不错,但在您实际开始编码和测试初始域模型之前,我不会创建一个硬而快速的域模型,因为您可能会发现事情不太按预期工作,或者有些东西你错过了,或者要求改变了等等。
其他点快速浏览一下。
更新响应:
现在大多数事情的标准设计是添加一个服务层,即带有 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.
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?)