Struts, spring, and hibernate-my understanding

Source: Internet
Author: User

These three frameworks are particularly popular in China and abroad. I have learned from these three frameworks for more than half a year.

First, we need to figure out that these three things are three frameworks. they are not function libraries used to directly solve some problems. They just encapsulate some existing knowledge and technology in a program to achieve some effect. Maybe this effect is what you want, maybe not, so not all of them are gold-rich. They can be used in many occasions, but not all.

1. Struts

Struts encapsulates the web layer and processes resources in a centralized manner. The biggest feature of Struts is its configuration file. development with Struts cannot reduce the development difficulty. On the contrary, it may increase. however, after the maintenance, other people will check the program. view the struts configuration file to clearly understand the context of the program. the idea of Struts is MVC, which separates the current code from the interface. struts now contains a lot of things, not every one of which is worth learning. Struts labels and other things are completely unnecessary. Let's say that the interface is more concise, but it is not easy to remember how to use these labels. struts implements an idea. To implement this idea, you do not need to use struts. MVC can be implemented using Servlet + JSP, and the efficiency is higher if the project is relatively small. after learning struts, you only need to remember one thing-MVC. The source code of Struts is not complex. You can better understand the idea of the source code.

2. Spring

The core of spring is IOC and AOP. In the entire source code package of spring, these two ideas are always used in a hybrid manner, with the aim of decoupling. IOC represents this coupling with the configuration file, instead of in code, the core of AOP is the same word, interception, processing, and proxy. spring is not used in every place of the program. If there are too many configuration files, it seems more troublesome. I personally think that spring is mainly used between layers and in team development, each part focuses on its own part. Spring is used to connect the block and the block. If it is also used in the layer, the configuration file is in a large category, which is not clear but inconvenient to debug, the configuration file cannot be found out if an error occurs. spring is also an idea. There are many ways to solve a problem. Spring is only one of them, which may not be the best or the worst, use it in the appropriate place. implementing decoupling with your own code is also a good method. we don't need to hold things that are popular online.

3. hibernate

Like the above two frameworks, Hibernate is nothing new. In a program, it encapsulates JDBC. then the programmer can operate the database with the idea of facing objects. this framework is very popular. It is said that ejb3.0 has something about it. hibernte is actually to encapsulate the tables in the database into classes using configuration files, and then the programmer can operate on these classes. Here is the work of a simplified common programmer, however, some people must be proficient in writing configuration files. configuration files are troublesome. Although there are many automatic tools that can help us accomplish many things, we have to modify the details on our own. many people on the Internet say that hibernate can improve the performance of database access. I don't fully agree here. For common queries, because hibernate has a level-1 cache and a level-2 cache, the query does not need to be in the database, which is much faster. However, if there are many data updates in a program, Hibernate is slower than JDBC, it must first select data from the database, change the data, and finally submit the data. It executes more SQL statements than JDBC, and this situation exists in many places. the combination of spring and Hibernate is better, and the development delivery rate does not increase slightly. If you are not familiar with these two frameworks, it will be troublesome and the error cannot be easily solved.

Summary: there is no need to understand every detail of these three frameworks. The most important thing is their ideas. if it is completely self-learning, it is not easy to learn these three frameworks. Beginners are often confused about what they are doing. in addition, I often get excited during the course of learning: I learned from others at the same time, and I have worked on several projects with JDBC and JSP. I am still working on these three frameworks and cannot understand them. after learning about JDBC, you will have a better understanding of JSP. I think there is no need to learn these three frameworks. It is good to learn them, and I have no idea whether I have learned them. it is better to use a tool that others think is good but not familiar.

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.