Zend Framework PHP Coding Standard, It’s the New Black
First let me say wow! Ok, this is my first book, so I wasn’t prepared to meet all these new friends. Thanks to EVERYONE who has written me. Even if you are just saying thanks for the book, I appreciate every one of them. Some of you have taken the time to send me spelling errors and errata that you have found in the book. I sincerely appreciate it and am correcting the manuscript with each one of them.
Ok, now down to the point. Last night I was on IM (I hang in #phpc on irc.freenode.net with 140 of my close friends) and I was talking with Evil_Otto about coding standards. I am a firm believer in coding standards. I used to not care about coding standards but after you become a manager and have to deal with two developers who are constantly reformatting each others code, you become a believer in a hurry.
I tried to make sure all examples in the book and in the zip files were coded to the Zend Framework PHP Coding Standard. I do know I missed it on a few points but nothing that should keep your code from running.
Honestly, I don’t particularly agree with all of the standard. However, it is a standard so I did my best to adhere to it.
If you don’t have a standard yet for your personal programming or for your team, I strongly suggest that you consider the Zend Framework PHP Coding Standard. Not because this is the “right” way to code and how you are doing it is “wrong”. If we all do it the same way, it makes all of our lives just a little bit easier. (not much, but a little)
Just a thought, thanks again for all the emails!
=C=
Reader's Comments
Hey Cal,
thanks for your appeal on using coding standards. When I read your comment how you became a believer in coding standards I thought “oh yes, it is so true”.
Thanks for the book as well!
Hi Cal,
Which ones do you disagree with, I wonder?
My pet peeves are _ prefix on protected vars and the space before the ( on an if.
Regards,
Rob…
I’ve always had kind of a flexible coding style (generally I try to adhere to existing coding styles if I’m working on someone else’s code) but the one thing that bugs me about the Zend standard is the opening brace on the same line as the condition in an if statement, eg
if (foo) {
}
I’ve always put the opening brace on a new line.
I agree about the curly braces, not a very good idea.
I pusblished here:
http://www.dotkernel.com/dotkernel-coding-standard/
our company coding standard , which is basically ZF standards, with very few exceptions.
Leave a Reply