DRP Learning Evolutionary model

Source: Internet
Author: User

What has been done is to follow the thought of the three-level system, which is U. B, D. Sitting, beginning to increase the design mode, increase sqlhelper, gradually understand the system can be divided into only three layers, layers, with the continuous deepening of learning to clear the "why will appear layered." Know is one thing, the key is in the "How to use", so we are still for the "stratification" and make unremitting efforts ...

Now I learned the DRP. And you know a hierarchy: MVC (Model-view-control).


The official language is descriptive: organize code in a way that separates business logic, data, and interfaces, and aggregates business logic into a single component, at the same time that it improves and customizes the interface and user interaction. There is no need to write business logic again. For the friends who have systematic experience, these descriptive narratives are deeply understood.

Let's take a brief look at the whole story of this model.

First, the predecessor of MVC

A very easy call, from the front end to the JSP to the business logic.

The figure shows its merits: simple structure and easy operation.

Look at the second eye: Lock the JSP. 1, to obtain the page number of references,
2. Call the business logic.
3, to return data
4. Render Page
5. Response the rendered result to the front page
If you want to classify JSP responsibilities, it is consistent. Then 4 (rendered page) is out of tune, because we have the front end, this JSP has "business logic processing", and "page processing", which is in the three layer. It belongs to the U,b mash-up.
So his shortcoming is: The duty is not unitary, the responsibility is overweight, is inconvenient to maintain. But this is suitable for small project development.

No matter what layered thought is the same, it is to "single duty." Easy to manage ", since the layering is not thorough. Then it's time to split again. with MVC.

Second, MVC

This diagram overcomes the problem of "mash-up", which is suitable for large-scale project development compared to the one just mentioned.
The ability to invoke "business logic" in a JSP is shared by introducing a servlet. Let JSP just do "render page" to implement the page and business logic of the row station.


The separation of the front-end and business logic is done here, but as we said before, a system has more than "X" layers, which we know as "layers". is a general-purpose, well-written specification that, in practice, can be abstracted from a "known layer" based on business needs. Packaging belongs to the "system" layer.

The next thing to say is to add a "data access" layer on the basis of MVC. Of course. This does not belong to a particular system unique. Basically all of the system will involve access to the database, and the database connection drive points, methods, etc. are basically consistent. So it can be encapsulated into a layer, as a "persistent layer".

The use of a general persistence layer is combined with DAO, which uses the "Factory mode" in DAO to encapsulate the creation process.


There are several important principles in the design of a durable layer: fine-grained ———— fine-grained to achieve high reusability.


: To simply ———— do not involve or very little too much business logic.

A step-by-step evolutionary model is the evolution of a thought. There is a very important idea. be lazy in action and be positive in your thoughts . In order to be lazy in action, and to initiate the mind movement, this is "code reuse."



Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

DRP Learning Evolutionary model

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.