Advantages and disadvantages of SSH framework

Source: Internet
Author: User

1.struts

The struts framework has the advantages of modularity, flexibility, and reusability of components, while simplifying the development of MVC-based Web applications.

Advantages:
Struts, like Tomcat, turbine and many other Apache projects, is open source software, which is one of its great advantages. Enables developers to gain a deeper understanding of their internal implementation mechanisms.
In addition, the advantages of struts are mainly embodied in two aspects: Taglib and page navigation. Taglib is the tag library of struts, which can be used flexibly to greatly improve the development efficiency. In addition, for the current domestic JSP developers, in addition to making

With the common markup that comes with JSP, it is very rare to develop your own markup, perhaps struts is a good starting point.
About page navigation, I think that will be a future direction of development, in fact, to do so, so that the system's context clearer. Through a configuration file, you can grasp the connection between the parts of the whole system, which for the later maintenance has

The greatest benefit. This is especially true when another group of developers took over the project.


In addition, struts is the industry "standard" (many success stories), learning resources, HTML tags are very good

Disadvantages:
Taglib is a great advantage for struts, but for beginners it requires a continuous learning process and even disrupts your web authoring habits, but when you get used to it, you think it's really great.
Struts divides MVC's controller into three, increasing the complexity of the system while gaining a clearer structure.
Actionforms is inconvenient and cannot be unit tested (Strutstestcase can only be used for integration)


"IT168 Technical Documentation"
Struts, like Tomcat, turbine and many other Apache projects, is open source software, which is one of its great advantages. Enables developers to gain a deeper understanding of their internal implementation mechanisms. The Struts open source framework was created to enable developers

It is easier to build Web applications that are based on Java servlet and JavaServer Pages (JSP) technology. The Struts framework provides a unified standard framework for the open, and by using struts as a foundation, developers can focus on

The business logic of the application. The struts framework itself is an model-view-controller (MVC) Implementation using Java Servlet and JavaServer pages technology.
In particular, struts has the following advantages:

1. Implement the MVC pattern with a clear structure that allows developers to focus only on the implementation of the business logic.

2. There is a rich tag can be used, struts of the tag library (Taglib), if flexible to use, it can greatly improve the development efficiency. In addition, in the current domestic JSP developers, in addition to the use of JSP comes with common tags, rarely developed

Own mark, perhaps struts is a good starting point.

3. Page navigation. Page navigation will be a future development direction, in fact, to do so, so that the system's context clearer. Through a configuration file, you can grasp the connection between the parts of the whole system, which for later maintenance has

The greatest advantage. This is especially true when another group of developers took over the project.

4. Provide exception processing mechanism.

5. Database Link Pool Management

6. Support i18n

Disadvantages:
First, go to the presentation layer, you need to configure the forward, each go to the presentation layer, I believe most are directly to the JSP, and involves the steering, need to configure forward, if there are 10 display layer of the JSP, need to configure 10 times struts

, and does not include sometimes directories, file changes, need to re-modify forward, note that each time the configuration is modified to require redeployment of the entire project, and tomcate such a server, you must restart the server, if the business

It is simply unthinkable to change a system that is complex and frequent. Now that is so, tens of hundreds of people at the same time online use of our system, you can imagine how much I worry.

The action of Struts must be the Thread-safe method, which only allows one instance to handle all requests. So all the resources that the action uses must be synchronized uniformly, which raises the thread-safety issue.

Third, the test is not convenient. Each of struts's actions is coupled to the web layer so that its tests depend on the Web container and unit tests are difficult to implement. But there is a junit extension tool struts testcase can implement it

Unit tests.

Iv. types of conversions. The Formbean of struts takes all the data as a string type, which can be converted using the tool commons-beanutils. But its transformation is at the class level, and the type of conversion is not

Configurable. It is also very difficult to return the error message to the user when the type is converted.

V. The dependency on the servlet is too strong. Struts must rely on servletrequest and servletresponse when handling action, all of which are not able to get rid of the servlet container.

Vi. front-end expression language aspects. Struts integrates Jstl, so it uses the JSTL expression language primarily to get data. But Jstl's expression language is weak in terms of collection and indexed properties.

Vii. control of action execution is difficult. Struts creates an action, which can be very difficult if you want to control the order in which it is executed. You'll even have to write the servlet again to implement your functional requirements.

Eight, the action to perform before and after the processing. Struts handles action as a class-based hierarchies, which makes it difficult to operate before and after action processing.

Nine, the incident support is not enough. In struts, it is actually a form form that corresponds to an action class (or Dispatchaction), in other words: in struts it is actually a form that only corresponds to one event, and struts is

is a coarse-grained event compared to the application Event,application event and the component event.

Struts important Form Object Actionform is an object that represents an application that contains at least a few fields that are input fields in a JSP page form, because a form corresponds to an event,

To, when we need to refine the event granularity to these fields in the form, that is, when a field corresponds to an event, simply using struts is less likely, and of course it can be done by combining JavaScript.

2. Hibernate
Hibernate is an open-source object-relational mapping framework that provides JDBC with a very lightweight object encapsulation that allows Java programmers to manipulate databases at will using object programming thinking.
Hibernate can be applied to any JDBC application, both in Java client applications and in servlet/jsp Web applications, and most revolutionary of all, hibernate can be used in the EE architecture of EJB application.

Replace CMP to complete the task of data persistence.
Most development agencies often take the creation of their own separate data persistence layer. Once the underlying data structure changes, the cost of modifying the rest of the application to accommodate this change is enormous. Hibernate fills in a timely manner

This gap, which provides an easy-to-use, efficient object-relational mapping framework for Java applications. Hibernate is a lightweight persistence framework with a very rich function.

Advantages:
A.hibernate uses the Java reflection mechanism rather than the bytecode enhancer to achieve transparency.
The performance of b.hibernate is very good because it is a lightweight framework. The flexibility of the mapping is excellent.
C. It supports a variety of relational databases, ranging from one-to-one to many-to-many complex relationships.


Disadvantage: It restricts the object model you are using. (for example, a persistent class cannot be mapped to more than one table) its unique interface and poor market share also make people uneasy, however, Hibernate has been relieved with its powerful development momentum

These risks. Other open source persistence frameworks also have some, but none have the market impact of Hibernate.

The above huitie mood is a little excited, I hope understanding, I am not because someone criticized hibernate and feel unhappy, but because the comments in the post really make me feel ridiculous. It doesn't matter if you think hibernate is good or not, the only thing I think

Unfortunately, there is no real high-level evaluation of hibernate in the Chinese forum. There is a hot thread about hibernate on the TSS, followed by hundreds of stickers, including hibernate author Gavin and Lido Jdo

CTO, there have been some heated debates about JDO and hibernate, I have watched patiently and still haven't found a really powerful attack against hibernate, and those so-called attacks are nothing more than a GUI-based Configurator for hibernate

Without the support of commercial companies, the lack of standardization and so on these flimsy reasons.

Add a few points to my comments:

Hibernate is a lightweight object encapsulation of JDBC, which is a stand-alone object persistence layer framework, and the app Server, and EJB have no inevitable connection. Hibernate can be used in any JDBC-ready scenario, such as Java

The application's database access code, the DAO interface implementation class, can even be a BMP inside the Access database code. In this sense, hibernate and EB are not a category of things, and there is no either-or relationship.

Hibernate is a framework that is closely related to JDBC, so hibernate compatibility and JDBC driver have a certain relationship with the database, but the Java program that uses it has nothing to do with the app server, nor does it exist

compatibility issues.

Hibernate cannot be used to directly compare with the entity bean, only in the framework of the entire EE project. And even in the overall framework of software, Hibernate appears as a substitute for JDBC, and

Instead of being replaced by an entity bean, let me list the frame structure that I have listed n times:

The traditional architecture:
1) Session bean <-> Entity Bean <-> DB
To address the alternative architecture of performance barriers:
2) Session Bean <-> DAO <-> JDBC <-> DB
A schema that uses Hibernate to improve the development efficiency of the above architecture:
3) Session Bean <-> DAO <-> Hibernate <-> DB

The above 3 architectures are analyzed:
1, memory consumption: The use of JDBC Architecture 2 is undoubtedly the most memory-saving, Hibernate architecture 3 times, EB Architecture 1 the worst.

2, operating efficiency: If JDBC code write is very optimized, then the JDBC schema is the most efficient, but the actual project, this is almost impossible, which requires the programmer is very proficient in JDBC, the use of batch statements, adjust

Preapredstatement the batch size and fetch size parameters, as well as the use of the result set cache if necessary, and so on. In general, programmers can't do this. So the hibernate architecture shows the fastest running

Efficiency. EB's architecture is far less efficient.

3, development efficiency: with JBuilder support and simple projects, EB architecture development efficiency is highest, JDBC second, hibernate is the worst. However, in large projects, especially when the persistence layer relationship mapping is complex, hibernate

The rate is surprisingly high, JDBC is second, and the EB architecture is likely to fail.

4. Distributed, security check, cluster, load balancing support
Since there is no difference in the facade,3 architecture of SB.


Iv. What is the difficulty of studying EB and hibernate?

Where is the difficulty of EB? Not on complex XML configuration files, but in the slightest careless use of EB, there are serious performance hurdles. So hard when you need to learn a lot of EJB design patterns to avoid performance problems, you need to learn about App server and EB's

Configuration to optimize the efficiency of EB operation. To do EB development work, most of the programmer's energy is put on the performance of EB, but there is no more attention to their own focus on the main focus on the design of the persistence layer of the object.

Where is hibernate difficult? Not in Hibernate itself complex, in fact hibernate is very simple, difficult in hibernate too flexible.

When you use EB to achieve the persistence layer, you will find that EB is too clumsy, clumsy to you have no choice at all, so you do not have to spend energy to design programs, to balance the quality of the plan, to the cost of thinking

Choose which option, because only the only solution in front of you, you can only do so, there is no choice.

Hibernate on the contrary, it is too flexible, the same problem, you can at least design more than 10 kinds of solutions to solve, so especially puzzled, on earth with this, or with that? What is the difference between these programs? They run the original

What's the difference? Running efficiency which is better? Just the primary key generation, there are seven or eight kinds of options for you to choose, you are embarrassed? Set properties can be set, you can use list, you can also use bag, in the end which high efficiency, you embarrassed not for

Difficult? Query can be used iterator, can use list, which is good, what is the difference? Are you embarrassed? Composite PRIMARY key You can configure it directly in HBM, or you can customize the CustomerType, which is better? Are you embarrassed?

For a table, you can choose a single mapping of an object, you can also map to a parent-child object, you can also map to two 1:1 of the object, under what circumstances in which scenario is better, you are embarrassed?

This list can be listed all the time until you don't want to see it anymore. When you have a myriad of dazzling solutions in front of you, you will feel happy? Or is it sad? If you are a responsible programmer, then you will definitely

Careful study of the differences in each scenario, the efficiency of each scheme, the application of each scenario, you will feel that you have been caught in the pull out. If you're using EB, you've made your decision in the first second and have no choice at all, for example, set

You can only use collection, if it is hibernate, you will be hesitant between bag,list and set, even if it is unclear, the program will not be able to write.


3. Spring
It is an open source project and is currently very active, it is based on the framework of the IOC (inversion of control, reverse control) and AOP Architecture Multilayer Java EE system, but it does not force you to have to use spring in every layer, because

Modularity is good for it, allowing you to choose one of its modules according to your needs, it implements a very elegant MVC, provides a unified interface for different data access technologies, and uses the IOC to make it easy to implement bean loading

Provide concise AOP and implement transcation managment, etc.
Advantages
A. Spring can effectively organize your middle-tier objects, whether or not you choose to use EJBS. If you just use struts or other framework,spring specifically designed for the Java EE API, focus on solving the remaining problems.
B. Spring can eliminate the overuse of singleton that is common in many projects. In my experience, this is a big problem, and it lowers the testability and object-oriented aspects of the system.
C. By processing a configuration file in a way that is consistent across applications and projects, spring eliminates the need for a variety of custom-formatted properties files. What kind of magical attribute or system is it looking for in a class?

Have to read Javadoc and even source code? With spring, you just need to look at the JavaBean property of the class. The use of inversion of control (discussed below) helped to accomplish this simplification.
D. By minimizing the cost of programming interfaces rather than classes, spring can promote good programming practices.
E. Spring is designed so that applications created with it depend as little as possible on his APIs. Most business objects in a spring application are not dependent on spring.
F. Applications built using spring are easy to unit test.
G. Spring makes the use of ejbs an implementation choice, not an inevitable choice for application architectures. You can choose to use POJOs or local EJBS to implement the business interface without affecting the calling code.
H. Spring helps you solve many problems without using EJBS. Spring provides an alternative to EJBS that can be used in many Web applications. For example, spring can use AOP to provide declarative transaction management without passing through the EJB container, if

You just have to deal with a single database, and you don't even need a JTA implementation.
I. Spring provides a consistent framework for data access, whether it is using JDBC or O/R mapping products such as hibernate.
Spring does allow you to solve your problem with the simplest possible solution. And that's a lot of value.

Disadvantage: The number of users, the JSP to write a lot of code, the controller is too flexible, missing a public controller

Advantages and disadvantages of the SSH framework

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.