"Anatomy PetShop" series One: PetShop system architecture Design

Source: Internet
Author: User

In software architecture design, layered structure is the most common and most important structure. Microsoft's recommended layered structure is generally divided into three layers, from the bottom to the following: Data access layer, business logic layer (or to become a domain layer), the presentation layer, as shown in the figure:

Fig. 1:3 Layered Structure

Data access layer: sometimes called the persistence layer, its function is mainly responsible for database access. The simple argument is to implement the select,insert,update,delete of the datasheet. If you want to add an ORM element, you will include the mapping between the object and the datasheet, and the persistence of the object entity. In the PetShop data Access layer, ORM is not used, resulting in an increase in code volume that can be seen as a major failure in the overall design implementation.

Business Logic Layer: The core of the entire system, it is related to the business (domain) of the system. In the case of PetShop, the relevant design of the business logic layer is related to the logic of the online pet shop, such as searching for pets, placing orders, adding pets to shopping carts and so on. If access to the database is involved, call the data access layer.

Presentation layer: The UI part of the system that is responsible for the interaction of the user with the entire system. In this layer, the ideal state is not to include the system's business logic. The logical code in the presentation layer, only related to the interface element. In PetShop, it is designed using asp.net, so it contains a number of Web controls and related logic.

What is the advantage of layered structure? Martin Fowler the answer in the book Patterns of Enterprise Application Architecture:

1, developers can only focus on the entire structure of one of the layers;

2, can be easily replaced by the new implementation of the original level of implementation;

3, can reduce the layer and the dependence between layers;

4, conducive to standardization;

5, conducive to the reuse of the logic of each layer.

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.