A little experience in developing large projects in PHP

Source: Internet
Author: User
One, variable


it is best to store all variables in an array, which can be a lot of convenience in the development of the program, especially when the program is very large. The name of the variable is appropriate to their own habits, whether using pinyin or English, at least there should be a certain meaning, so as to fit the memory. The name of the variable is as normalized as possible and not in conflict with the keywords in PHP.


Second, function


PHP comes with a lot of functions, which gives us a lot of convenience in programming. Of course, in large programs we tend to define many functions ourselves, dozens of or even hundreds. Of course in the use of classes in the program is not called function, it should be called methods, here for the moment do not talk about the use of classes. A lot of functions, it will inevitably confuse. Is there any way to solve this problem? You can refer to the use of the above variable, as well, we can put our own definition of the function name all in an array. In this way we can check whether the function has a duplicate definition at any time in the process of using the array. If you find a repetition, you can change it immediately. Improve the speed of program writing. The use of functions there is also a point to note that the global variable, although this is a small problem, but it can not be ignored, or when a variable thousands of calls out of the time, hehe. Then see if the variable has been declared as a global variable in the function.


three, the annotation of the procedure

The annotation of the
program is very important, whether it is C or Java, the annotation of the program can often reflect the programmer's good programming style. Whether it is for others or for their own good, of course, we are talking about the development of large-scale projects, the spirit of teamwork is very important. When your program is written out, it's hard to understand how to talk about teamwork. Of course if this large project is developed by you alone, it is another matter, or you are pressed for time to write a note. In general, however, this is rarely the case. Unless it's really a very moment. A good programmer will definitely annotate every program he writes, even if it's for himself. (material)


Iv. What kind of text editing software is used to write source program


This actually also does not have certain stipulation, as long as oneself likes on the line. I prefer phpedit, may be used, and now feel a leave Phpedit write PHP does not feel, beginners PHP when using Notepad, because the program is relatively simple. So use Notepad to cope with the line, for hundreds of lines of procedures, with Notepad is obviously not appropriate. Use Phpedit productivity will improve several times, even if you never use.


Five, the design of database

The design of
database is very important in the development of large-scale projects, which is related to the success or failure of the whole project development. The concrete also does not say more. Everyone can accumulate experience in their own practice, slowly to experience. In general the design of the database should preferably be identified at the outset. Although you can change the design of the database structure in the process of development, but this for the overall project development efficiency will be greatly reduced, who would be willing to change the structure of the database from time to time?


Six, the use of class

The use of the
class is mainly to achieve the reuse of code to reduce the time of project development, the programmer's workload will be reduced a lot. As long as the class can be used where the class should be used as much as possible, the use of classes should develop a good habit, so that you can be in the real use of the class place handy. It can be said that a large PHP project is composed of classes. The taste of the medium or oneself slowly realize it.


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.