Preliminary study: Vo,bo and PO

Source: Internet
Author: User

just a few days before the company, was arranged to read the document, mainly on the current project of the technology selection and framework of basic understanding. Used by the company is now a common frameworkSpring,Strutsand theMyBatis. It's pretty simple to understand, but it's a bunch ofVO,BOand thePOto make not clear, and now also developed a few lines, with some preliminary understanding, the first summary.

po:persistantobject Persistent objects. The concept that occurs at the O/R mapping, without the O/R mapping, does not exist. Can be seen as a Java object mapped to a table in the database.

The most vivid understanding is that a PO is a record in the database. Multiple records can be used with a collection of PO. The PO should not contain any operations on 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: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.

VO, Value Objects (Valueobject), PO, persistent objects (Persisentobject), are all composed of a set of get and set methods of properties and properties. Structurally, they are nothing different. But it is completely different from its meaning and nature:

First: Vo is created with the New keyword and is reclaimed by the GC. The PO is created when new data is added to the database, and the data in the database is deleted. And it can only survive in a database connection, and the disconnection is destroyed.

Second: Vo is a value object, the precise point is that it is a business object, is living in the business layer, is used by business logic, it is the purpose of survival is to provide a place for the data to survive. The PO is stateful, and each property represents its current state. It is the object representation of the physical data. Using it, we can decouple our programs from physical data and simplify the transformation between the object data and the physical data.

Third: The properties of VO are different depending on the current business, that is, each of its properties corresponds to the name of the data required for the current business logic. The properties of the PO correspond to the field one by one of the database table.

Now for VO,BO and PO are only preliminary understanding, but also need to be more profound in the project to discover their role.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Preliminary study: Vo,bo and PO

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.