At this week's technical workshop, the department's colleagues put forward different opinions on the use of PO and VO. Like the controversy of Hibernate Chinese websites, it has formed two opinions. The one is PO can be used in commercial logic, as VO The one disagree with this view, think that PO is not suitable in commercial logic, I am the supporter of this.
I will say my own point of view and reason:
PO can only be used in the data layer, VO is used in the commercial logic layer and the representation layer. The layers of the layers belong to this layer of data, so that the coupling between the layers can be reduced to facilitate maintenance and expansion of the system.
Of course, we sometimes use PO in a commercial logic or represent layer in the actual project, I think it is allowed to be allowed when the following conditions are satisfied.
That is, the status of PO in this business logic does not change, such as commercial logic of a product details.
to sum up:
Whether it is a design or system design, the principle is consistent: class, all part of the system is simple and simple, good encapsulation, logic and data are kept independent.