studlyCaps or under_scores in PHP5's OO interface? - Blog - Open Source - - php, photography and private stuff

studlyCaps or under_scores in PHP5's OO interface?

The big question for PHP5 currently is the discussion around the new dual-syntax system, which allows extensions to be used with a procedural and an object oriented interface. The problem is, that PHP usually uses "_" to devide parts of a function name, where most OO languages (e.g. Java, C#,...) use studlyCaps to divide method name parts. And this is the common way in OO programming with PHP, too (as we from PEAR defined once upon a time...).

There was (and I guess already is) a big discussion on the PHP internals mailinglist about that issue and PHP internal developers ran into a heavy guerilla war about that issue. John Coggeshall recently called for comments from the PHP userland on his blog, what I guess is a pretty good idea, since PHP users will have to live for a long time.

In my personal opinion, PHP's OO interface should stick to the standards which were defined by PEAR. Usually PEAR follows inventions of PHP, the PHP guys now should one time follow PEAR. In general the "foo_bar against fooBar" discussions seems to result in a matter of personal favor. There are many arguments for and against each style, but I guess the most effective argument is what users want. IMHO, most OO PHP users should be used to the studlyCaps way and for that PHP itself should use it. No matter if methods then do not look like functions, but indeed, they aren't the same.

But take your own picture on John's Weblog, the PHP internals thread and your personal experiences and leave a comment here or on John's blog.

If you liked this blog post or learned something, please consider using flattr to contribute back: .



Add new comment

Fields with bold names are mandatory.