The Advancing PHP Developer Part 1: Coding Standards

In: PHP| Web development

25 May 2008

level upA question that I hear often is how can one evolve as a PHP developer? The answer varies and depends on the person's programming knowledge and experience. I will cover the topics I think are the most important briefly in this series, provide links and maybe expand on them in the future.

I will assume intermediate level PHP competency as this is where most developers end up. They are capable of developing small projects, but their code isn't of great quality and they waste time and resources solving the same problems again and again.

This guide is about improving:

  1. Maintainability
  2. Development speed
  3. Coding practices
  4. Toolset
  5. Deployment

Part 1. Coding standards

Why coding standards are important: Coding standards are all about improving maintainability and teamwork. High quality code should reveal its intention to competent programmers without relying on documentation, though any set of coding standards includes some documentation practices (my favorite are phpDoc blocks).

When I began to think about code as prose that should transmit its meaning rather than being merely functional, my code quality started to constantly improve. When you consider how code will look as well as work, you create code that is more readable and hence more maintainable and share-able (in a team setting).

Some languages, like Python, force the programmer to use a certain coding standards - which is why some love it and some hate it.

For PHP, I use the Zend Framework coding styles which I think are great.

Extra reference material:
Wikiepedia - Programming Style
PEAR coding standards
Professional PHP blog on coding standards
A list of coding style guides

Next up: Object Orientation.

Share this article: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • DZone
  • del.icio.us
  • Technorati

1 Response to The Advancing PHP Developer Part 1: Coding Standards

Avatar

Carlton Dickson

July 15th, 2008 at 10:31 am

This is a really important point Eran, looking at other developer’s code is always tricky but even more of a challenge when their coding style differs so much to yours. Best thing to do at the beginning of a project is agree to follow a certain standard, it will make live easier if one of the developers leaves you team and you’re required to pick up their work.

Comment Form

About this blog

Eran Galperin is an Internet entrepreneur and head of development @ Lionite.

In this Blog he writes about Internet ventures and web development.

  • thomas: hi i have 3 tables like a ,b c where a contains employee detail , b contains details of item con [...]
  • Glaubensfragen « bohuco.net: [...] Blog-Eintrag “Common misconceptions in web application development” beleuchtet einige imme [...]
  • Eran Galperin: Plain SQL :) of course, I make sure to properly filter and escape user input [...]
  • Arik Fraimovich: @Eran & @George - thank you for the information. Going to rewrite some queries now :) @Eran - [...]
  • George: @Arik Fraimovich: REPLACE and ON DUPLICATE KEY UPDATE are actually quite different. REPLACE actually [...]