Recently engaged in a project, the use of SPRINGMVC, deepened my understanding of VO and po, feeling and hair.
1 Tips for writing before
VO = = Value Object
PO = = Persistant Object
Vo corresponding to the page, PO corresponding entity/relational mapping
2 in your program, if you do not have VO, then it is likely that your program is not designed with object-oriented thinking, or you think of the PO as VO at the same time.
Entity:
Order {
Id
CreateDate
}
When the order creation time filter is required on my page, there are two ways, one is non-object-oriented design, the other is to add Createdatestart, Createdateclose in the PO, that is
Order {
Id
CreateDate
Createdatestart
Createdateclose
}
This time is Order even if PO is VO
Why not use a more elegant design
Ordervalueobject {
Id
Createdatestart
Createdateclose
}
Orderpersistenceobject {
Id
CreateDate
}
Isn't it clearer and more elegant? What the? Is the code very high? Oh, my friend, don't you know there's a code generator for this thing?
The use of VO and PO for Java