web developer's blog

Archive for the ‘PHP’ Category

php anachronic coding standards

with 15 comments

When you take a look at the primary PHP coding standards, like PEAR or Zend, there’s what you can find there:

Private class members are preceded by a single underscore.

or:

For methods on objects that are declared with the “private” or “protected” modifier, the first character of the method name must be an underscore. This is the only acceptable application of an underscore in a method name. Methods declared “public” should never contain an underscore.

The question which comes instantly to my mind is: why? Is there any reason why this convention should be kept when PHP object oriented programming has gone a long way since PHP 4 (when there was no access modifiers and such underscore was the only fast way to distinguish public from, hmm, not public methods and properties) ? Are, for instance (as one of major OOP languages), Java coding standards pushing towards such naming convention? No!

I think that we, as developers, should not stick to this silly convention. For the sake of progress, stop looking back (because that what in fact this convention is) and  stop supporting this one, particular naming convention.

Written by Leszek Stachowski

October 18, 2010 at 12:48 am

Posted in PHP

Tagged with , , , ,