Po,vo,bo,dto,pojo (POCO), DAO Difference (reprint)

Source: Internet
Author: User

PO:
Persistant Object Persistent Objects

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:
Business Object

The main role is to encapsulate the business logic as an object. This object can include one or more other objects.
such as a resume, education experience, work experience, social relations and so on.
We can have an education experience corresponding to a PO, work experience corresponding to a PO, social relations corresponding to a PO.
Create a CV-based Bo object to process resumes, each BO containing these po.
When we handle business logic like this, we can deal with Bo.


VO:
Value Object Value objects
ViewObject Presentation Layer Objects

The data object that the main interface displays. For a Web page, or an interface for SWT and swing, use a Vo object to correspond to the value of the entire interface.


Dto:
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:
Plain ordinary Java object simple Ava object
Personal feeling Pojo is the most changeable object, an intermediate object, and the most common object we deal with.

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 Information
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


In summary, I think an object is what o to see the specific environment, 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 deal with the various logic, so that we can better to use object-oriented approach to deal with the problem.

Original URL: http://blog.chinaunix.net/uid-20556037-id-2810927.html

Po,vo,bo,dto,pojo (POCO), DAO Difference (reprint)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.