Original article address: attention is the most important and the most important thing to do in learning a framework. But in fact, countless programmers do not care about this. Programmers always read the reference for various reasons:
1. Reading English documents is too difficult
It should be said that reading English documents is one of the basic qualities of every programmer, which is the same as the process of programming. If you don't even have the patience to debug the program, let's give up the programmer's career as soon as possible. In fact, reading documents, especially English documents, is also the basic quality of programmers. This quality is accumulated at 1.1 points. Therefore, for those friends who really find it difficult, I suggest reading it together with Chinese documents. Fortunately, manjianghong's open-source supporters have carefully translated many valuable documents for you, such as spring and hibernate. But I still think,Chinese documents must be compared with English documentsOtherwise, you may be lost in a lot of semantic mismatch.
2. Reference is too thick to grasp ideas
Patience, patience, or patience. In terms of reference quality, in fact, the reference of most open-source frameworks is quite good. In particular, struts2 is basically a combination of specialized wiki articles. Speaking of spring, you can only cultivate your patience.
I strongly recommend that you carefully read the reference provided by the open-source framework for the following two reasons:
1. Most of these built-in references come from the authors of these open-source frameworks. Who else do you know about their products better than they do? What are the advantages of Self-written programs and how to use them? You must be the clearest. Therefore, when talking about authority, it is impossible to have any documents that are more authoritative than reference.
2. the built-in reference rarely makes mistakes, so it will not mislead you. Furthermore, many references have summarized the best practices for using many frameworks. Why don't we go to these references to obtain first-hand information?
Of course, many people may find reference boring. It doesn't matter. I suggest you read it several times. First, you can use scan to understand the framework. The second time, read the key chapters carefully and add some code practices. Third, read the questions and find the answers in the document. For many beginners, reading the reference method is very low. Instead, they turn to books and online tutorials. In view of these learning materials, I had to look at them with colored glasses.
AnyI think there is no need to read valuable books.. One of the major features of these books is that they will cost you a lot of money. In addition, these books have many errors, and the examples have basically no practical significance. Even more sadly, many examples in these books do not use their brains or contain some best practices in program development, or even give them to many readers: "The program is written like this" is misleading.
There are also many original tutorials on the network, such as the XXX in Action series. Books in the XXX in Action series are well received in the market. I have read many of these series of books. I do not think that these series of books are superior to the reference provided by the Framework. Some Understandings of these series also have the personal feelings of some authors. In fact, everyone writes a book or writes an article with their own emotional colors. This is not a bad thing, but since we already have a reference, why should we leave it close? Of course, I have to say that this series of books is still quite well written, but it is better than reference.
At the same time, netizens also mentioned a lot of network tutorials. Network tutorials, especially Chinese online tutorials, are based on the experiences of netizens and are also written into a series of articles. My Opinion on network tutorials is:Less read and intensive reading. Because the online tutorials are spontaneous by netizens, I have to say that the online tutorials written by many netizens are messy and mislead the world. At the same time, there are also many network-written Tutorials that are quite good and can be used as an entry-level reference. However, for beginners, it is difficult to tell the authenticity of the content. Bet on the size of the bet with luck, bet on the right bet, right, wrong bet on their own. Therefore, for online tutorials, it is best to read with questions and search for your answers, rather than reading them as core documents. I do not know how many beginners have actually run the sample project that comes with each open-source framework in the environment. In my experience, this is definitely the best way to learn.
Take struts2 as an example, there is a directory of apps under the root directory of struts2, there are war packages such as struts2-blank-2.0.11.war, struts2-showcase-2.0.11.war, struts2-portlet-2.0.11.war. You only need to place these war packages in the running environment of any application server. For example, you can put it in the Tomcat webapps directory and start Tomcat. Then you can directly access a project with many built-in struts features.
In fact, you can get a lot of useful information from these projects. In addition, once you encounter insurmountable difficulties when using some features of struts2, you can also find solutions to problems from these projects. What makes you more reassured is that at least these projects express the original meaning of the struts2 author. As long as you write code according to its sample, there will always be no errors.
Here, I will give a simple example to illustrate what you can learn from these projects:
1. if you carefully study the struts2-blank-2.0.11.war project, it will tell you how to build the simplest struts2 project; it will also tell you, which jar packages must be depended on by struts2 at least (do not worry about jar package errors in the future). At the same time, some examples are provided for you, Web. how to write XML, struts. how to write XML.
2. struts2-showcase-2.0.11.war this project, you can see a hodgedge of struts2 features, which is quite helpful for you to see reference. For example, if you see the "File Upload" section while reading the document, you can refer to the upload subdirectory in the project. This is equivalent to a ready-made running example provided here while reading the document. Is this more practical than the so-called network tutorials?
3. The struts2-portlet-2.0.11.war gives the application of struts2 in the portal environment.
Therefore, in general, the projects that come with the framework are the first-hand materials you have learned. Basically, you don't need to look for examples written by others on the Internet. What is the original ecology? If you write a sample project by yourself, you can understand it as well. However, I have seen many programmers with a low eye. I can brag about how the framework works and how convenient it is. Let him use these frameworks to write a program. After a long time, he was unable to run the program.
So,Practice is the only criterion for testing truth. Only by yourself can you say that you have mastered a technology and understood a framework. When writing your own sample project, you may wish to use the simplest user addition, deletion, modification, and query as your business scenario, and constantly refactor your code in practice, to improve your level. If you are familiar with the use of an open-source framework, the internal principles of the debug open-source framework are also quite clear. You may have some problems with some of the design principles (maybe only for those who are diligent in thinking ). At this time, I think you can try to look at the source code of the open-source framework.
I think there are some special ways to use the source code of the open-source framework. I like to do debug in the program to see what classes are running inside the open-source framework and how they are executed.I firmly oppose package-by-package viewing the source code, which is meaningless.Because it is equivalent to breaking down a physical body and a program in good running state, you can split it apart and obviously do not understand anything. In the program debug source code, you can view not only each class in the program execution process, but also the running status of these classes. This is the way to read the source code.