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

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.

主站蜘蛛池模板: 浙江省| 项城市| 冀州市| 新蔡县| 台南县| 万年县| 金川县| 客服| 阳西县| 昌黎县| 罗平县| 平凉市| 呼玛县| 吉安县| 武鸣县| 庆元县| 公安县| 垣曲县| 长武县| 枣阳市| 慈利县| 洛阳市| 大名县| 嘉善县| 丰县| 长治县| 武胜县| 攀枝花市| 怀远县| 巧家县| 柘荣县| 平乐县| 安宁市| 阿坝县| 南郑县| 绥德县| 同仁县| 玉山县| 庐江县| 进贤县| 东乡|