PHP5 and Questioning OOP
An Interview with Sterling Hughes on PHP5 from the PHP-Con site:
Personally, while I have programmed with both C++ and Java, I am mostly a procedural guy. I feel that most object oriented programming consists of abstracting different problems into the same problem and then resolving that problem. Sure it makes it easier, but its incredibly inefficient for developing a small set of interconnected programs, which really is the whole point in web development.
That’s not to say I’m unhappy with PHP5. Most of the stuff in PHP5 is great, most notably exceptions; I’ll certainly be taking advantage of many of the new features in Zend Engine 2. But most of my code is procedural, and Zend Engine 2 is mostly an object oriented functionality upgrade.
That’s the second time this week I’ve come across an opinion that questions the benefits of the OOP-at-all-costs approach to programming. The first was in Paul Graham’s The Hundred Year Language:
Somehow the idea of reusability got attached to object-oriented programming in the 1980s, and no amount of evidence to the contrary seems to be able to shake it free. But although some object-oriented software is reusable, what makes it reusable is its bottom-upness, not its object-orientedness. Consider libraries: they’re reusable because they’re language, whether they’re written in an object-oriented style or not.
I don’t predict the demise of object-oriented programming, by the way. Though I don’t think it has much to offer good programmers, except in certain specialized domains, it is irresistible to large organizations. Object-oriented programming offers a sustainable way to write spaghetti code. It lets you accrete programs as a series of patches. Large organizations always tend to develop software this way, and I expect this to be as true in a hundred years as it is today.
As undergraduates, we have been exposed to the joys of object oriented programming from our first week at Uni, possible because we’re supposedly destined for the large organisations Paul mentions. It’s nice to see the view from the other side of the fence for a change.