PHP Best Practices

Source: http://laurat.blogs.com/talks/best_practices_apachecon.pdf

Definition: Best Practices

- Knowing what’s in the toolbox
- Knowing the strengths and weaknesses of your tools
- Using the tools appropriately, and in the most efficient fashion
- Having a working, consistent, repeatable process.

Your PHP should

- be simple
- get the job done
- be secure
- be scalable and performant
- be producible and maintainable

Write good code

- Above all, code needs to be readable and maintainable

Beware clever code:
- cool design patterns
- obscure performance tweaks
- niche language features

Coding Standards

- Have and use a coding standard
- Zend Framework, PEAR, homebrew
- Legacy code always a problem

Don'ts

- Make the rules awkward and difficult to remember
- Apps Hungarian
- Force millions of include files (performance hit)
- Force complete OO (c.f. Simple)

Source: http://laurat.blogs.com/talks/best_practices_apachecon.pdf

No comments: