官术网_书友最值得收藏!

Layers

A layer is merely a logical division that has a responsibility within the architecture of the application. It is a logical way to organize the application code. Martin Fowler's book Patterns of Enterprise Application Architecture describes the three main layers and their responsibilities:

 

Thus, the classes of an application are logically separated according to their responsibilities. There are classes that are used in the data-access layer, while other classes prepare the data to be displayed as part of the presentation layer. This division is purely logical. A good architecture practice is to have a layered chain where a layer interacts with its adjacent layer, providing and consuming services. This leads to more cohesion (the same responsibilities are contained in the same layer) and low-coupling.

Let's look at the following diagram:

We can see that the JSF, JSP, and HTML pages, the bean-backing class, and even a servlet belong logically to the presentation layer group, since they have the same basic responsibility, which is to send information to the user and receive requests from a user. An EJB, a servlet (part of it), and a Business Object belong to the business layer. The DAO classes and the JPA entities belong to the data layer.

主站蜘蛛池模板: 安吉县| 西华县| 稻城县| 天台县| 辽源市| 晋江市| 安远县| 诸城市| 抚顺县| 翼城县| 怀化市| 南靖县| 黔南| 宁明县| 宝清县| 宣化县| 远安县| 甘南县| 红原县| 谷城县| 循化| 仪陇县| 望江县| 英吉沙县| 微山县| 定襄县| 盘锦市| 顺平县| 托里县| 磐安县| 句容市| 郸城县| 珲春市| 绍兴市| 长阳| 莎车县| 砚山县| 米脂县| 陇南市| 石泉县| 深泽县|