How to read a PHP source code

Source: Internet
Author: User
Tags documentation php source code

A good source code such as DZ's Forum, Wind Forum, Imperial Cms,dedecms and so on, have their own set of design ideas and design patterns, so before looking at a product to be prepared psychologically, you can compare their experience with these products, but do not always use their own thinking to judge. The sentence is "to look at the dialectical thought of learning and criticism."

All right, let's get started!

How do we go about reading a PHP source code?

One. Start by installing the source code, combining its documentation and manuals, to familiarize itself with its functionality and how it is applied.

Two. Browse the directory structure of the source code to understand the capabilities of each directory.

Three. After the above two steps to believe that you have a preliminary understanding of the open source product, then start to analyze its source code it now. In this step we begin to analyze the source code framework. For example, the entry mode is a single entry or multiple entrances, the call rules between pages, can find out a function of the page according to the rules.

Four. Familiar with the source code writing style, such as indentation, layout format.

Five. Familiar with the source code used in the database and tables, you can refer to its technical support documentation.

Six. After several steps I believe that we have a deeper understanding of the source code, but this understanding is only superficial, down from 6 aspects of the specific to analyze it:

1. Portal construction and the implementation of the way the page calls, if you read the tool class and tool functions, try to familiarize yourself. This step of analysis can be learned from the source code of the system architecture.

2. Analyze the source code used in the tool class and tool functions, so you can learn a lot of programming skills. Can improve their programming skills.

3. Combine some security rules to study how this source code implements security-related design. This can improve their awareness and skill in security.

4. If there is a template engine, study the source code of the template engine. Roughly from the realization of the way, efficiency, ease of use, and so on several aspects to consider.

5. Study the system of each function module, so that can learn programming skills can also open their own programming ideas, the next encounter similar dongdong in the heart of the spectrum.

6. The research system uses the design pattern, the same function realization, uses the design pattern to be possible to differ many, compared with us before the Dongdong analysis design pattern, is promotes us to control the code the begotten.

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

The method is only the way and the tool, the concrete practice also needs everybody's effort. Their own feelings is not anxious, serious analysis, the analysis of the experience to use their own specific projects, hehe!

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.