“This is the 8th day of my participation in the August Gwen Challenge.

Everything is an object

Java language is now the mainstream language of the back end, based on the form of classes, such as MVC mode, the control layer controller and transformation layer,

In the process of program development there will be a lot of classes for us to use, generally we are common are more meaningful entity classes, such as simple data types,

  • Open interface layer: Service methods can be directly encapsulated to expose RPC interface; HTTP interface encapsulated through the Web; Gateway security control, traffic control, etc.

  • Terminal display layer: The layer where the templates on each end render and perform the display. Currently, velocity rendering, JS rendering, JSP rendering, mobile terminal display, etc.

  • Web layer: it mainly forwards access control, verifies all kinds of basic parameters, or simply deals with services that do not reuse.

  • Service layer: The relatively specific business logic Service layer

  • Manager layer: General business processing layer, which has the following characteristics:

    • For the layer encapsulated by the third party platform, preprocessing returned results and transforming abnormal information;
    • The sinking of common capabilities of the Service layer, such as caching schemes, middleware common processing;
    • Interacts with the DAO layer to reuse multiple DAOs in combination.
  • DAO layer: Data access layer, which interacts with MySQL, Oracle, and Hbase at the bottom.

  • External interface or third party platform: including RPC open interface of other departments, base platform, HTTP interface of other companies

Attributes in a simple entity class represent, of course, the actual use of the class is some fields, we call it:

The above figure correctly shows the alias names of some necessary classes object in the process of data interaction

DO: data table name:

Data Access Object is an object-oriented database interface

Classes that operate most directly on CRUD in a database (data access classes for short)

In my development process, it is to access the controller to call the service layer — “DAO layer”, and then mapper maps out the implementation method of dao layer finally, a structure of four layers

This is what we call do, because we operate directly on the table structure

Dto: data transfer object

Data transfer (return values of interface methods, interface input parameters, etc.)

Is for the fixed implementation of specific business functions and determined methods; Since the encapsulation method in the process will be specific to the mapping implementation, mapper.xml, prevent SQL injection process

To put it simply, we need to encapsulate a method to specify our return values, input arguments, etc. — we need this class as an intermediate object to operate on the data table

Vo: Displays objects on the front-end page

The appearance of this object is displayed on the front page to form, in theory, the back-end output data format fields, dTO. However, the front-end display may need to consider the user experience, thus separating a VO object object for the front-end to use;

POJO: General name of DO/DTO/BO/VO

All objects that entity classes interact with may be called POJOs

Simple is that you can have attributes, implement Lombok’s @data annotation methods, get/set, and toString methods

Alibaba’s specification establishes regulations for various objects: