Writing Better PHP: Three Guides
The Web Dev Zone is brought to you in partnership with Mendix. Discover how IT departments looking for ways to keep up with demand for business apps has caused a new breed of developers to surface - the Rapid Application Developer.
It's true that, in some sense, programming is all the same; and in some sense, thinking about assembly is a good way to think about programming in general. But even if 'assemble, link, load' is a good way to think about programming, it's probably a very confusing way to think about programs written in a high-level language.
Sometimes, then, improving your generic 'programming brain' will help you improve your facility with a particular language. At other times, it's more important to learn the nuances of a language, paying close attention to the kind of applications the language is used for. Like as a carpenter can improve his general ability to measure things, or learn a lot about lathes in particular -- and in fact the carpenter always needs to improve both.
For improving your PHP, then, you can do two things: become a better programmer; and understand PHP more finely, more deeply.
These three guides better your PHP, ordered from most programming-general to most PHP-specific:
- 10 Tips for Writing Better PHP Code is really ten tips for writing better code, period. You probably won't learn anything absolutely new from this guide ('name your variables and functions well', 'comment your code', 'test your code often'), but it reminds you of the basics and offers a few reasons for why best general programming practices are particularly important for apps written in PHP.
- How To Write Better PHP Code: These 7 Ways addresses some temptations PHP developers are especially likely to face (not using templates, encapsulating too little, confusing PHP and SQL for CRUD), and offers ways to eliminate kinds of sloppiness especially likely to harm the performance of PHP apps ('reduce db queries' for high-volume web applications, for example).
All three are worth reading, depending on what you're going for.