I would love to see that we make our developer’s lives easier while doing WordPress. One step to do so is to offer a clear coding styleguide and to apply it on the codebase. Because for most of the code it is not (“Legacy is so WordPress 3.0″ I heard someone from the other side of the room). I put this blogpost online because I’d like to see some feedback/discussion previous to this weeks developer meeting.
From what I’ve learned over the years with coding standards, each project might have other ones. Further I learned that the PEAR and ZEND FRAMEWORK coding standards are pretty much well adopted in the PHP area. The good thing with those coding styleguides is, that they are well documented and more or less well known. And we can handle them with ease in quality control because tools exist for those out of the box. Most styles I had in PHP projects then were somehow based on the one or other one.
I know this is the WordPress project and things should be easy right upfront, so please take my question seriously and do not feel offended: Why not switch over to PEAR or ZEND FRAMEWORK styles? Or to just get more out of those? The project can benefit in many ways. The current styleguide we have is pretty much not ready and fragmented (see links below). Next to this, the (somehow) existing style is not constantly applied to the codebase so it does not make a difference if the current or a new one is applied. It should be pretty much the same amount of work.
Next to clarifying which style to apply (it might be some other/own style as well, PEAR / ZEND is only a suggestion (albeit a very preferable one)) there should be taken care for the coding style on each file then. This is some work and it should be coordinated otherwise it looks impossible to me that developers will constantly take care. I suggest to do this pre the 3.0 first beta release. So all beta-testers will see a nicely-ordered codebase there and patches can be easily applied. I can offer to create tools that can be used in support of applying standards to the code until the 3.0 feature-freeze date on February 15, 2010.
I know that those things aren’t easy to decide so I would love to see feedback here to get a first overview. If you comment on your prefered coding styleguide, please add some lines how you used it already and what your experiences are. I’ll start with my own comment. I’m aware that there are personal preferences. I know some programmers who even do not join a project if they do not accept the coding standard used therein. But I have no fear that we meet those here in the project :).
- WordPress Coding Style by Matt and Ryan (written down by Mark Jaquith) (Originally)
- WordPress Coding Standards (the Codex Page)
- PEAR Coding Standards (External Project)
- ZEND Coding Standards (External Project)
Follow Up: Coding Standards Summary of the last Week (28 Jan 2010; by hakre)