At ThinkUp, we've produced a lot of developer documentation on how to write great PHP code, the kind of code that's worthy of acceptance into the project. But if I were to suggest a general list of PHP best practices, I could not have done a better job than Josh Lockhart's PHP (The Right Way). It's a strong collection of generic guidelines and resources, and I'm pleased to see that it describes a lot of what we do at ThinkUp.
PHP is deeply flawed, but it remains the leading "gateway" language for new web developers. Coding Horror's Jeff Atwood wants this to change. He argues that veteran developers should start actively working to end the PHP singularity. The first step, he says, is to stop using it in new projects—something even seasoned developers like Marco Arment have difficulty doing.
I applaud Atwood for kicking off an ambitious cultural shift in the web development world. Good programmers should use great tools, ideally, from the beginning. But, this is a battle I didn't choose to fight quite this way.
PHP is not the best tool to use, but I chose it for ThinkUp for two reasons. First, when you're building a webapp that users run on their servers, PHP is the only reasonable choice, because LAMP is the most widely available web server stack out there. Second, one of ThinkUp's community goals is to bring new coders into open source. PHP is the language of new web developers, so using it in ThinkUp attracts that talent pool.
Staunch anti-PHPers could say that's just perpetuating the problem of encouraging new programmers to start with bad tools. I see it as an evolutionary, rather than revolutionary, approach. Even in PHP, it is possible to teach new coders best practices like object-oriented programming, test-driven development, design patterns, documentation-driven development, and the importance of consistent code style. If amateur web developers want to level up to pro, a good place to start is in a language they already know.
Cross-posted to the ThinkUp blog.