I’m sure everyone has heard the phrase, “The great thing about standards is that there are so many to choose from.” I think we finally have a coding standard for everything we do at Found Line – from PHP to CSS to web file names. We’ve gone through a couple of iterations and various options but here’s what we’ve come up with.
For application code we’ve decided to simply follow the Zend Framework PHP Coding Standard. It gives us guidance on PHP file formatting, naming conventions, coding style, and inline documentation. If it works for a project like Zend Framework with a large number of developers it should work for us. Plus, I wouldn’t be surprise if many applications start standardizing on Zend Framework conventions so following their standards should put us in a good position when doing integration work.
For id and class names in XHTML and CSS we’ve decided to adopt the microformats naming principle of dash-separated-lowercase-words. This is the only CSS naming convention I’ve seen that has a real purpose behind it. We will try to use names from existing microformat standards before coming up with our own. However, when we have to come up with our own names at least they will be consistent with the microformat names.
For files that will be web-accessible we’ve decided to use the dash-separated-lowercase-words standard as well. This is for a couple of reasons. First, it’s consistent with what Zend Framework expects. Second, Matt Cutts recommends dashes instead of underscores as word separators.