Introduction Of SSH Frame

 

J2EE typical three-tier soructure, divided into presentation layer, middle layer (Business Logic Tier) and the data services layer. Three-tier system business rules, data access and work on checking the legitimacy of the middle layer. The client does not directly interact with the database, but by middle-tier components and establish a connection, and then by the middle-tier and database interaction.

after The performance of the JSP layer is the traditional technology, since its inception in 1999, years of development, its wide range of applications and stable performance, the performance of its technology as a solid foundation.

Middle layer is used in the popular Spring + Hibernate, in order to control the separation layer and Business Logic Tier, is divided into the following types of fine.
Web layer, which is the MVC pattern of "C" (controller), Business Logic Tier is responsible for control and performance of the interactive layer, called Business Logic Tier, and operational performance data back to the organization level for the performance of the system using the MVC framework Struts.

Service Layer (Business Logic Tier is), is responsible for the achievement of business logic. Business Logic Tier is based on a DAO layer, through the positive components of the DAO mode packaging, the completion of the requirements of the system business logic.

DAO layer is responsible for interaction with the persistent object. The layers of data by package, delete, search, change the operation.

PO,persistent object. Through the entity-relational mapping tool for relational database will be mapped into the data object, it is convenient to operate in object-oriented database, the system uses Hibernate as the ORM framework.

The role of Spring runs through the entire middle layer, the Web layer, Service layer, DAO layer and seamless integration of PO, the data services layer is used to store data.

A good framework allows developers to reduce the re-establishment of programs to solve complex problems and energy burden; it can be expanded to a customized internal; and have a strong user community to support it. Framework is usually a good solution to a problem. However, your application is layered, and may each layer requires its own framework. Only solve the UI problem does not mean that you can be good business logic and persistence logic and UI components of a good coupling.

There is no denying that for simple applications, using ASP or PHP development using J2EE framework more efficient than the development of higher efficiency. Some may even think: this hierarchical structure, than the general adoption of the JSP + Servlet even lower efficiency of system development.

The author of several about the perspective from on this issue.

1. The development of efficiency: Software Engineering is a special industry, unlike the traditional industries, such as electrical appliances, construction and automotive industries. Products of these industries, once developed, the delivery of very few users will need to follow-up maintenance. However, different from the software industry, software products, the latter is a huge operation and maintenance of the project, purely from the pre-development time to consider the efficiency of its development is not rational, but also unfair. As we all know, the traditional, such as ASP and PHP scripts site technology to a whole site business logic and the performance of logic mixed with ASP or PHP pages, resulting in very poor readability of the page, very low maintenance. Even if the need for a simple button to change the page, the page had no choice but to open the file, run the risk of damage to the system. However, the strict hierarchical structure of J2EE, you can completely avoid this problem. On the performance of the modified layer, even if an error occurs, the error will not be extended to the Business Logic Tier, but will not affect the persistence layer. Therefore, the use of J2EE layered architecture, even if the pre-development efficiency slightly lower, but it is also worthwhile.

2. The demand for change: to the author many years of development experience, very few software products from the outset, is fixed. Customer demand for software, software development process with in-depth, constantly clear up. Therefore, often encountered in software development to a certain extent, due to customer demand for software has changed, making the realization of the software had to change. When the software needs to change, it can retain as much as possible part of the software, change as little as possible the realization of software to meet changes in customer needs? The answer is - the use of the decoupling of outstanding architecture. This architecture is a layered J2EE framework, layered architecture in the best, the control layer depends on Business Logic Tier, but not with any specific business logic component coupling, only coupling with the interface; Similarly, the Business Logic Tier-dependent in the DAO layer, but also will not have any specific DAO component coupling, but oriented programming interface. The use of the software in this way, even if some software changes, other parts do not change as much as possible.

Note: Even in the traditional hardware business, there are a large number of interface specification. For example, PCI interface, graphics or network card, as long as they comply with the PCI specifications, you can insert the motherboard, and motherboard communications. As for the realization of this internal card is not of concern to the motherboard, which is the programming interface for the benefits. If the need to improve computer performance, the need to update the graphics, as long as the replacement of the other PCI interface card, rather than abandon the whole computer. If a computer is not combined with a variety of interfaces, but the entire cause, it would mean that even if the only need to update the card, but also to give up the whole computer. Similarly, for a software component, as a component of the need for reconstruction as far as possible, will not affect other components. In fact, this is the best, even the best of the current structure, will be affected to a certain extent, this is also the need to strive to improve the software engineering area.

Technology updates, system reconstruction: technical update the software industry very soon, although the development of the software industry unpleasant, but small-scale technology update particularly fast. Once the changes as a result of objective circumstances, had to replace the technology, how to ensure that the smallest change in this system? The answer is to choose the best structure.

Model 1 in the traditional structure of the program, as long as there is little change in demand, would mean giving up the entire page. Or rewritten. Although the early development of speed, unless it can be guaranteed to never change the structure of the application, or not to adopt the structure of Model 1.

The use of Hibernate as a persistence layer technology is the biggest advantage: You can completely object-oriented approach to system analysis, system design.
DAO pattern for each DAO interface DAO components prepared, at least at the same time provide an implementation class, according to the different needs, there may be a number of implementation class. Spring container using the factory instead of DAO.
Under normal circumstances, the introduction of interface will inevitably need to be responsible for the introduction of the factory to generate DAO components. Spring has two basic modes: single-state model and the factory model. Spring can be used to avoid the use of the factory model, because Spring is a very powerful plant. Therefore, Spring can serve as a DAO factory.

DAO from Spring to serve as factories, the factories do not need programmers to achieve their own model, only need to configure the DAO components in the Spring container, by the Application Context components responsible for the management of DAO can create. With Spring's dependency injection to provide the other components do not even visit the factories, as examples of direct access to DAO.

Advantages:

Struts with Tomcat, Turbine, and many other Apache projects, are open-source software, which is a major advantage of it. Allow developers to more in-depth understanding of the achievement of its internal mechanism.

In addition, Struts focused mainly on the merits in two aspects: Taglib and page navigation. Taglib is the Struts tag library, a flexible use, can greatly increase development efficiency. In addition, the current developer of the JSP, with the exception of the use of commonly used built-in JSP tag, very few markers to develop their own, perhaps of Struts is a good starting point.

On page navigation, I think it would be a development direction for the future, in fact, to do so, make the system more clearly the context. Through a configuration file, you can grasp the whole system links between the various parts, which the latter has an immense amount of good maintenance. Especially when another group of developers to take over the project, this reflected a more obvious advantage.

Disadvantages:

Taglib is one of the major advantages of Struts, but for a beginner run, it requires a continuous learning process, and may even disrupt the habit of preparing your website, but when you get used to it, you will find it really rods.

Struts will be a Controller of the MVC is divided into three, in obtaining a more clear structure, but also increase the complexity of the system.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值