Coding Styles

Permalink
This post may sound like I'm having a bit of a moan (I possibly am having a bit of a moan), but I'm hoping something productive can come of it, so I'd be really interested to get some comments back.

I'm in the process of writing up a PHP Coding Style document for the company I'm working for. Easy, I thought, all we use here is C5 and Zend Framework. both of whom publish their Coding Styles. I realize that a lot of the code from C5 doesn't adhear to the Coding Styles that are in the guidelines, but that's not ultimately important. What is ultimately important is that there is a good set of guidelines that are being working towards by the Core team and contributing developers. And to make it even easier (or so I thought) C5's Coding Style page starts with this statement "the structure for this document has been taken from the Zend Framework Coding Style Guide." I've since noted it uses the word "structure" not "content".

The big issue here is naming conventions. I'm trying to code in a way that meets Zend's strict guidelines, but C5's guidelines differ from Zends. In fact, they also differ from their own... For example:
==========================================
# Within models, all functions and class
names should be camel-cased, with no
underscores used to separate terms.
# Within controllers, all functions should
be lowercase, with underscores used.
==========================================

Other key difference: Zend insist on no underscores in variable names, they should all be camelCased, C5 insist on underscores. Similarly with filenames.

I'm just trying to find a firm base for how to style my code. I'm tempted to go the Zend route, because of the huge following Zend has and their prominence, plus the fact that it is used within C5. However, it isn't great that my addon would be rejected from the marketplace, because it adhears to Zends file and class naming conventions. (In fact, I don't think it would even work, need to check that...)
** edit: checked, it doesn't work **

Any thoughts??

Jon

jbx
 
jbx replied on at Permalink Reply
jbx
And one last thing... Use tabs not spaces?? Really?? Have you not seen the inconsitency in layout this can cause between editors with different tab settings? A space is always a space. One character width. A tab is whatever the user (or editor) feels like defining it as.

Ok, I really will shut up for a while now and let someone else comment :)

Jon