3-tier architecture in my way-3

Source: Internet
Author: User

Now it is really difficult to find a complete time. On and off, there will be a great leap in thinking. In this case, I may be able to find more things from my mind. Next, let's continue with yesterday's topic...

Persistent Layer
I subdivided this layer into three levels: persistent objects, data interfaces, and databases.
1. Database
The Analysis and Design of databases are the expertise of DBAs. I know that we should follow three paradigms as much as possible. For business execution efficiency, sometimes it may even violate the paradigm. It is very important to design and draw an ER diagram. It is also helpful to find an excellent ER model. After you drag the data table and fields to complete the design, you can directly deploy it to the database!
2. Persistent Object
Based on the designed database to create objects, my approach is very simple, that is, to create an object for each table, the object attribute is the fields in the database, objects are added, deleted, modified, and queried. For the relationship between 1 A and n B, a B object set is added to the attribute of a. This B object set is generally inherited from list or map, used to store N bits. In this way, the database is clearly described.
3. Data interfaces
This part mainly establishes the connection between objects and databases. There are many specific ways to connect to the database. You can easily use a universal connection pool. We need to write a parsing interface to convert the Persistent object into the corresponding content of each table in the database, and then encapsulate the data read from the database into the Persistent Object.
In addition, this resolution interface can also be applied in the presentation layer. After a persistent object is processed, it must be converted into a table that can be viewed as HTML before it comes to the page, the interface implementation method here may be slightly different from the database interface implementation method mentioned above.

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.