Layering of software

Source: Internet
Author: User

Layering of software

The current structure of typical application software: three-layer structure

Presentation layer: Provides an interface to interact with the user. The GUI (graphical user interface) and the Web page are two typical examples of the presentation layer.

Business Logic Layer: implementing various business logic.

Database layer: Responsible for storing and managing persistent business data for applications.

distinguishing between physical and logical layers

The layering of software has two meanings: one is the physical layering, that is, each layer runs on a separate machine, which means creating a distributed software system; a logical layering, which refers to accomplishing a particular function in a single software module.

The business logic layer and the database layer are running on the same machine, this machine is the application server and the database server, so the whole system is divided into two layers in physics, and the logic is divided into three-layer structure.

features of the software layer

The software layer must conform to the following characteristics:

1. Each layer consists of a set of related classes or components (such as EJBS) that perform specific functions together.

2. There is a top-down dependency between layers and layers, that is, the upper component accesses the API for the underlying build, and the underlying component should not rely on the upper component. For example, the presentation layer relies on the business logic layer, while the business logic layer relies on the database layer. (Basic characteristics)

3, each layer to the upper level of public API, but the specific implementation details of external transparency. When the implementation of a layer changes, as long as its API unchanged, will not affect the implementation of other layers. (Open interface up, encapsulate implementation details)

Advantages of software tiering

The proper layering of software will improve the following performance of the software.

1, scalability (refers to whether the application support more users)

2, maintainability (refers to when changes in demand, just modify a part of the software, will not affect the other parts of the code.) The more layers, the more maintainable it will be.

3, scalability (refers to the ease of adding new functionality to existing systems) the fewer layers there are, the easier it is to break existing program structures by adding new features. The larger the number of layers, the extension points can be provided in each layer, without breaking the overall framework of the application.

4, reusability (refers to the program code is not redundant, the same program to meet a variety of requirements)

5. Manageability (Ease of management system)

Disadvantages of software tiering

The more software layering, the higher the requirements for software designers. In the design phase, it must take time to conceive a reasonable architecture. In addition, the more software layers, the more difficult debugging will be. If the application scale is small, the business logic is very simple, but the few software layers will simplify the development process and improve the development efficiency.

persistence layer for Java applications

The business logic layer is not only responsible for the business logic, but also accesses the database directly, provides the increment, deletion, modification and check operation of the business data. In order to separate data access details from business logic, data access can be used as a separate persistence layer.

"Data Access" is a professional term that refers to generating the appropriate SQL statements in the application code and then accessing the database through the JDBC API, adding, deleting, changing, and checking the data.

The persistence layer encapsulates data access details and provides an object-oriented API for the business logic layer. The perfect persistence layer should achieve the following objectives:

1, the Code reusability High, can complete all the database access operation.

2, if need, can support a variety of database platform.

3, has the relative independence, when the persistence layer's realization changes, does not affect the upper level realization.

At present in the persistence layer field, there have been many excellent ORM software, some commercial, some developed source code. Hibernate is an ORM software that develops source code. ORM Software has the characteristics of middleware. Middleware is the connection pipeline between applications and systems. Hibernate can be viewed as a conduit for connecting Java applications and relational databases. The difference between middleware and common application code is that the former is highly reusable and applicable to a variety of applications; the latter is related to specific business functions, and the application code of different business areas is obviously not the same. Another feature of the middleware is transparency, which, as a hibernate user, does not need to care how it is implemented, just to know how to access its interface.

Transparency and encapsulation have the same meaning, and the transparency of software is achieved by encapsulating the implementation details.

Related Article

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.