How can I write good code?

Source: Internet
Author: User
Tags filter execution php and php code php framework

1. Use Php--rasmus Lerdorf only when needed (PHP founder)


Don't let PHP do anything, PHP is just a tool, each language has its own limitations
Don't be afraid to use a different language when you can't use PHP to solve it

2. As much as possible in MySQL with table--matt Mullenweg (WordPress founder)



3. Never trust your users--dave child

Dave Child is the creator of added bytes (formerly: www.ilovejackdaniels.com). Created cheat sheet for several languages (Getting started notes)

Dave wrote a few articles about PHP, and finally his advice was this:

Must have the absolute paranoid mentality. If you don't want your site to be constantly attacked, or if you're constantly having problems, assume that every user is malicious and that you will be on alert for a long time, which will make your site more secure.

4. Focus on caching--ben Balbo

Ben Balbo writes for SitePoint, who is the head of the PHP discussion group and the Open Source group, and recommends spending more effort on the PHP cache.

For those sites that don't change much, such as blogs, you can get a clear effect by setting up caching. If it is a slightly more complex site, such as shopping, there is a higher demand for caching settings, but usually the effect is very good. In essence, caching is the storage of content that is often used but not changed.

5. Speed up development through IDE, template or code fragment--chad Kieffer



6. Use PHP's filter function--joey Sochacki

The filter plugin needs to be installed, not universal, so ignore

7. Use PHP framework--josh Sharp

Using frames saves you time and eliminates errors, because PHP itself is too easy to learn. Because PHP is not very restrictive, it is easy to write code that is not standard, the solution is to use the framework. You can look at his article, "Benefits of using the framework"

8. Do not use PHP framework--rasmus Lerdorf

The biggest reason for the opposing view is the efficiency of execution.

At the Drupalcon 2008 conference, Rasmus through several "Hello World" compared to the implementation of pure PHP and several frameworks, the results show that PHP framework execution efficiency is far less than pure PHP code

[If you want to use a PHP framework, Rasmus recommends CodeIgniter (I recommend kohana, haha) because it's "least like a frame"]

9. Use multithreading--jack D. Herrington


10. Immediately open the error report--david Cummings

What I'd like to say to the PHP developers is that the level of error reporting is highest. See "2 Quick PHP Tips", in the long run, this saves a lot of time.

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.