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

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.

主站蜘蛛池模板: 盐边县| 八宿县| 西吉县| 应用必备| 甘肃省| 湘潭县| 宁安市| 汤阴县| 斗六市| 海安县| 壶关县| 克什克腾旗| 白银市| 吕梁市| 连州市| 桑植县| 防城港市| 武安市| 临夏县| 五指山市| 天祝| 图片| 绿春县| 灵台县| 湖南省| 延寿县| 绥阳县| 丹阳市| 西昌市| 嫩江县| 商水县| 大冶市| 望江县| 博爱县| 凤冈县| 肃宁县| 新竹县| 定边县| 雷波县| 青川县| 陇南市|