PO (named bean,entity, etc.) :
persistant Object Persistent objects, the display state of records in a database table in a Java object
The most vivid understanding is that a PO is a record in the database.
The advantage is that a record can be processed as an object and can be easily converted to other objects.
BO (named service,manager,business): Business Object Business Objects The main role is to encapsulate the business logic as an object. This object can include one or more other objects.
The image is described as the shape and action of an object, and of course there are some shapes and motions involving the object of the base. such as handling A person's business logic, have to sleep, eat, work, work and so on and so on, and may be related to the shape of others.
When we handle business logic like this, we can deal with Bo.
VO (from the same notation):
Value Object Value Objects
mainly reflected in the view of the object, for a Web page encapsulates the entire page's properties into an object. Then a Vo object is exchanged between the control layer and the view layer.
DTOs (processed po, may increase or decrease the properties of the PO):
data Transfer Object data transfer Objects
It is mainly used for remote calls, etc. where large quantities of objects need to be transferred.
For example, if we have 100 fields in a table, then the corresponding PO has 100 attributes.
but we just show 10 fields on the interface,
The client uses the Web service to get the data, and there is no need to pass the entire PO object to the client.
At this point we can pass the result to the client with a DTO with only these 10 attributes, and this will not expose the service-side table structure. After the client is reached, if the interface is displayed with this object, then its identity will be converted to VO.
POJO (POJO is a concept or interface in which identity and function change with the environment): Pojo has some private Parameters as the property of the object. Then for each Parameters defines the get and set methods as an interface for access Plain Ordinary Java object simple Java objects that is, Pojo is a simple generic Java object that does not contain business Logical OR persistent logic, etc., but not javabean, Entitybean, etc., does not have any special roles and classes or interfaces that do not inherit or implement any other Java framework.
Pojo objects are sometimes referred to as data objects, and are used in large numbers to represent objects in reality. A Pojo is a PO after persistence. It is the DTO that passes and passes directly through it . directly used to correspond to the presentation layer is VO
DAO (Data Access object):This everyone is most familiar with, and the above several o the biggest difference, basic without the possibility and necessity of mutual transformation. Primarily used to encapsulate access to a database. It can be pojo to the PO, with PO assembled VO, DTO
Controller control layer is mainly composed of Action/servlet (currently spring MVC is used by the @controller tag)This layer of business layer dealing with the view layer, responsible for transmitting the Vo object and call the Bo Layer business method, responsible for the view layer request data processing after the response to the view layer.
view (views layer)Mainly refers to the jsp,html and other documents formed by the display layer. Summing up to use specific X0 need to see the specific environment and project structure, in different layers, different applications, the identity of the object is not the same, and the transformation of the identity of the object is also very natural. Just as you are a husband to your wife, you are a child to your parents. These concepts are designed not to bluff but to better understand and handle all kinds of logic, so that we can better useObject OrientedWay to handle the problem.
In the normal development project, we must design each layer excessively, because this will bring a lot of work and repeat work. If you are not a large system, you can simplify some layers because the technology is service to the application.
The above noun in the actual project application example name (appellation-actual name) control layer (controller-action), Business Layer/Service layer (Bo-manager) entity layer (po-entity) DAO (DAO) View object (vo-this item omitted) view Layer (view-jsp/html)
PO BO VO DTO POJO DAO concept and its role