Seems like everyone else is displaying opinions on Namespaces in PHP. Yet another milestone in PHP’s quest to match every other language’s concept of OOP ;) . But seriously, like every other proposal that looks off-the-wall from the point of view of a developer, you have to keep in mind PHP is merely getting around to implementing a standard solution from other languages. Java has namespaces, C++ has namespaces, Ruby has modules, Perl has… You get the picture. PHP doesn’t have to follow the herd, but sometimes the herd-brain does have its good points.

The problem isn’t that namespaces are bad, it’s that these arcane structures seem to have so little impact on development in PHP today for many many people. Does that mean it’s unimportant? Appearances are deceiving – when intelligent people get something like namespaces into CVS it’s a signal that the community has decided it has value. Eventually everyone will see it has value, and then everyone will use it, and then all the protests will get relegated to some back country forum in the hinterlands of the internet.

I remember a few years ago the feedback on the idea of type hinting in function/method declarations. The chorus of “it will ruin dynamic typing” style protests resounded across the PHP landscape and continues to echo through forums even today. Honestly, if you can’t bother to apply some level of reasoning to a new solution then give the community a break and cease prattling like a manic prophet of the oncoming apocalypse standing on a street corner. Of course today every Joe and his dog is writing type-hinted code for PHP5, and dynamic typing appears to have survived the assault of this Javatastic invasion.

It’s tiresome enough that messages on the PHP Internals mailing list (I lurk – never saw a need to post until the day I might submit dodgy patches to irritate everyone…hehehe) deteriorate into tit-for-tat off-topic comments that spark a deluge of more emails I have to skip past or deductions worked out laboriously in the forebrains of strange people who don’t know what “C” is. At least sufficiently few people read the list not to get too misinformed, discouraged or plain put off by Joe Blogg’s latest diatribe on folk discussing proposals on IRC/IM when they’re asleep and not posting stuff publicly (or whatever). Get serious – emailing everything in detail is a horrible idea. It would add to the internals flood anyway! My inbox is bad enough!

My opinion, is that namespaces are a neat solution to an ever increasing problem – those freaking PEAR CS class names. Greg Beaver’s earlier input added the nails, and conjured up a nailgun, for the opposition’s coffin. There are other potential benefits of course like possible namespace level access modifiers, but screw those – I want to type less, and not have to read My_Cool_Freakin_Ever_Increasing_Length_Class_Name_Because_I_Love_Typing_Way_Too_Mucho all over my otherwise clean and awesome code. Roll on, Mucho::Gratias, and give my wrist muscles a wee break.

Related posts:

  1. Complex Web Pages with the Zend Framework?
  2. How a proposal process could work – if retaining contributors is a goal
  3. Mutation Testing Brain Dump
  4. The next major QS piece of work
  5. Refactoring an OpenID Library