Chapter 4 perfect Dao of spring

Source: Internet
Author: User
Note: I hope you can give me some comments after reading this article. No matter what you write, I hope you can give me support. Provide your valuable comments. I will continue to improve. Thank you. Friend.  

  Chapter 4 Spring Perfect Dao Before talking about it, let's talk about several layers that are frequently used in Web development. That is, the multi-layer combined development popular in Java ee. Let's not talk about its advantages first. Let's first understand what each layer is doing. When you understand this, you will naturally know the benefits of layering. In the past, we may like to write all services and data in one class or several methods in Web programming. In this way, the programming development speed does not need to be questioned and must be very fast. But do you want to have a problem? The software we developed is intended for customers. Once it is online, it means it has to run 24 hours a day. Can you ensure that it will not go wrong? If your test and OK are running for several years, there will be no errors during the last hundred years, but you cannot ensure that the customer's requirements remain unchanged. Do you not want to upgrade your software? Do you care about the new requirements raised by customers? We can develop a software for a year or less, but we need to maintain it most of the time and how to upgrade it so that it can meet the customer's constant needs. You can always think of these issues before development. I think you will naturally complete the code in layers. What we are talking about is logical layering. Here, I will first talk about the various layers used in web development and their responsibilities. Presentation LayerThis should be easy to understand. To put it bluntly, it is the page part that users can see through the browser, that is, the webpage. For B/S development, we can understand that C/S should be a Windows User Interface/Web user interface. We usually use a lot of software with a C/S structure. The most familiar one should be QQ. The subclasses of Jingjing listener are all c/s structures. Compared with the QQ Software, we see the presentation layer interface. The presentation layer is mostly used to accept user input data. Or display data to users. In short, most of them are visible and operable to users. Business logic layer (service layer)Among the many existing frameworks, there are front-end presentation layer, back-end database operations, and business layer management. But the final business must be written by our programmers. Because business needs are changing and may change at any time, it varies according to user needs. This layer should be the most important layer, and it is the core layer. It is mainly used to meet customer needs. If the business layer is subdivided, it can be divided into the business appearance layer and the business logic layer. First Business appearance layer:1. Accept user access data from the "presentation layer. 2. If the request requires read-only access to the data, the "Data Access" layer may be used for data access. 3. transfer requests to the business logic layer. 4. Return the response from the "business logic" layer to the "presentation layer ". 5. Maintain the temporary status between calls to the business logic layer. Business logic layer 1.Accept requests from the business appearance layer. 2.Requests are processed according to the encoding business logic. 3.Use the data access layer to obtain data from the data service layer. 4.Pass the processing result back to the "Business appearance" layer. Data access layer (DAO) ) This function is mainly used to obtain data from databases or other data services or send data to databases. This is commonly used CRUD (add, delete, modify, and query) operations on database tables. 1. accept requests from the "business logic" layer and obtain or send data from the data service. 2. Return the database query results to the business logic layer. Data Service Layer A system that can store data, such as databases or data files. The preceding section describes the responsibilities of each layer for hierarchical development. The following content is being written ....I hope you will keep an eye on my blog. Thank you.

 

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.