web developer's blog

Posts Tagged ‘php

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.

Advertisements

Written by Leszek Stachowski

October 18, 2010 at 12:48 am

Posted in PHP

Tagged with , , , ,

Semantically correct breadcrumbs in CakePHP

with one comment

I’ve recently started a discussion on CakePHP Google groups about HtmlHelper::getCrumbs() output. Currently, it generates a string of separated (by the chosen separator) links. It is of course correct syntactically, but semantically it is totally wrong – navigation elements like menus and breadcrumbs should be built using (x)html lists as they are a list of elements. For such purpose, tags like ul and ol are made.

Link to the discussion.

Link to the issue’s ticket.

Written by Leszek Stachowski

June 25, 2010 at 6:40 pm