Programmer's Source code reading method

Source: Internet
Author: User

The right way to learn is not only to make you more effective, but also to bring you closer to the truth. Beginner a project source code, often let beginners unprepared. The following methods hope to bring enlightenment and convenience for beginners. This learning approach is based on familiarity with the compilation environment and language. The most important thing is to make sure that the source code you want to read is a good one. Because reading the code is like reading a book. Good code gives you a lifetime benefit, and bad code leaves you with a shadow.

One. First install the source code to compile, combined with its documentation and manuals, familiar with its functions and its application methods. If you encounter an English document, then first of all, congratulations, if you look down, not only in the domestic opening of the system or the framework of the precedent, but also allows you to read the level of English greatly improved.

Two. Browse the directory structure of the source code to understand the capabilities of each directory. The overall view of the project is what the module is composed of, it is best to draw a drawing.

Three. After the above two steps you have a preliminary understanding of the source code, and now begin to analyze its source bar. In this step we begin to analyze the source code framework. For example, the entry method is a single entry or multi-entry, the page between the call rules, can be based on the rules to find a function of the page.

Four. Familiar with the code writing style of the source code, such as indentation, typesetting format, variable naming, function naming, etc.

Five. Familiarize yourself with the database and tables used in the source code, and refer to its technical support documentation.

Six. After the above steps are believed to have a deeper understanding of the source code, but this understanding is only superficial, down we from 7 aspects of the specific analysis it:

1. The entry structure and the specific implementation of the page invocation method, if you see the tool class and tool functions, try to familiarize yourself with it. This step of the analysis can learn the source code of the system architecture mode.

2. Analyze the tool classes and tool functions used in the source code, so you can learn a lot of programming techniques. You can improve your own programming skill.

3. Combine some security rules to study how this source code is designed for security. This can improve their awareness and skill in safety.

4. If you have a template engine, look at the source code template engine. Roughly from the implementation of the way, efficiency, ease of use and other aspects to consider.

5. Research the various functional modules of the system, so as to learn programming skills can also open their own programming ideas, the next time you encounter something similar to the heart has a spectrum.

6. The research system uses the design pattern, the same function realization, uses the design pattern to be possible to be different, compares the East analysis design pattern which we previously made, is enhances our harness code the only way.

7. Study the source code on Access pressure, execution efficiency, system efficiency, database query optimization.

Seven. Take notes and record the functionality, implementation, design framework, module organization, and code skills implemented by this open source code. The side record side summarizes the arrangement, to the learning thing more easily digest absorbs.

Eight. Practice is the only standard to test truth, modify some simpler functions, or write some simple sample, and debug it so that you can understand the code more clearly. At the same time, the framework of the source code generally have their own instances, modify the use of these instances, you can quickly understand the use of the framework.

Programmer's Source code reading method

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.