On illogical naming conventions
I spent a couple of days looking under the bonnet of Codeigniter, one of the most popular of the PHP frameworks out there.
And I like what I see. Mostly.
While looking at their style guide, I noticed what seems to be an illogical convention:
- table names are lowercase
- column names are lowercase
- variable names are lowercase
- function names are lowercase
- method names are lowercase
- class names are not
Why aren't all the class names lowercase too? Is there a real-world, practical reason for it or did someone decide in the early days that capitalisation is what makes a class recognisable as a class?
As far as I'm aware, PHP itself isn't case-sensitive, so a (simplistic) class like this:
class hello {
function hello() {
echo "hello magarac!\n";
}
}
can be instantiated in any of these ways:
$me = new hello();
$me = new HELLO();
$me = new hElLo();
$me = new Hello();
So, why force the developer to remember to capitalise class names? It requires extra effort but doesn't add any value, in my opinion. Mind you, I'm not singling out Codeigniter here. Most of the other frameworks do the same thing too, presumably for the same reasons.
If someone knows what those reasons are, I'd love to hear from them.
Due to the large volume of spam, comments are disabled. If you have anything relevant to say, you can leave a comment via Twitter, or contact me directly.