价值对象的业务逻辑
我认为价值对象不应该具有业务逻辑。
也许让其他程序员感到困惑。
对于Exmaple,
public class PersonVO {
private String name;
private int age;
public void somethingBusinessLogic() {
// Do very complecated logic -> Using Reflection, Conversion
}
}
如果我使用此vo,则必须查看vo逻辑如何工作。
许多程序员将其业务逻辑放在VO中。
我想知道什么是最佳实践?
I think value object should not have business logic.
That maybe confused other programmers.
for exmaple,
public class PersonVO {
private String name;
private int age;
public void somethingBusinessLogic() {
// Do very complecated logic -> Using Reflection, Conversion
}
}
If i use this VO, have to look vo logic how to work.
many of programmers put their business logic inside of VO.
I wonder what is best practice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您在应用程序中使用的架构。如果您已经进行了分层体系结构:
请阅读更多有关在这个美丽的答案中
It depends on what architecture you are using in application. If you have layered architecture:
Read more about other architectures here in this beautiful answer