Ken Guest’s online diary

July 17, 2015

When a Coding Standard isn’t.

Filed under: php — kenguest @ 13:16

If Tommy Cooper were still alive and into developing software, I think he’d have a great many oneliners to share.

The best one being “When is a coding standard not a coding standard? When it’s your own individual one!”.

Seriously though, hearing people say they follow their own style or coding-standard just makes me cringe.

If the coding standard that you use is an individual one, then please don’t call it a “standard” because by definition it isn’t. It’s an anti-standard.

Pick one that’s supported by the main IDEs (phpstorm, netbeans et al) and php_codesniffer (don’t forget it can also analyse your JavaScript and CSS). To be honest in one way I don’t really care which CS standard you choose, just pick one* and stick with it. Making up your own one, especially if it’s specific to yourself and nobody else, is just wasting other people’s time and will cost you later on. I’d go as far as to say it’s disrespectful.

Even if you’re just a one-guy-code-house. Somebody else may be called in to work on your code and the last thing they need to do is waste time parsing your [convoluted] code when the guy that paid you for it is pestering them for an update to get a specific bug that is costing them money (twice if you stop to think about it) fixed.

Consider the next guy who has to pick up your wonderfully-unique-snowflake-of-rubbish and get it working again.

If you’re working in a team, you should know all this anyway and be mature enough to know to play/code well with others and quit wasting their time. Otherwise just grow up.

END-OF-RANT

* $DEITY knows there are enough to choose from. Doing a quick “phpcs -i” on my laptop results shows me this list:

“The installed coding standards are Made, Ecg, PSR2, MySource, PSR1, PHPCompatibility, PEAR, Squiz, CodeIgniter, PHPCS and Zend”

1 Comment »

  1. […] you’re in luck. If you use php_codesniffer (and if you don’t, well shame on you), you’ll be able to get a report of old-style constructors fairly […]

    Pingback by Scan your code for old-style constructors using phpunit. | Ken Guest’s online diary — November 6, 2015 @ 13:53


RSS feed for comments on this post. TrackBack URI

Leave a comment

Create a free website or blog at WordPress.com.