The Revenge of OOP (Again)

rubyIt’s amazing to me how often technology concepts stall for years, long enough for everyone to forget how old they are and how close we were to implementing them way back when. Two recent (for me they both came up yesterday) examples of this are mobile web content and object-oriented programming.

I remember way back in 1998, WML became available, allowing web sites to format a subset of their content for mobile devices. I saw it work and was vaguely tempted to convert my web sites over to it, but it never seemed to go anywhere. Fast forward to 2005 and we now have XHTML allowing basically the same thing. But the adoption is still very low, especially considering how many Internet-enabled cell phones are out there. I think that’s about to change, now that we have Google Mobile. So if I was seeing web sites on mobile devices in 1998 and have been carrying around a web-enabled cell phone since 2000, why is mobile HTML just now becoming the hot thing? Because it sure ain’t new.

And OOP is even older. OOP was the hot, new thing back when I was in college. The simple explanation of object orientation is that programming “objects” bundle up all the aspects of a piece of data plus all the operations that can be performed with or upon that data into one portable, replicable, extensible data structure. Yeah, and that’s the simple explanation.

And believe me, it was considered a pretty serious brain-baker at the time, but everyone agreed that someday in the bright, glorious future absolutely everything would be object-oriented. The main argument for this being that the real world was object-oriented; that is, there is a connection between things, the data that describes them and the actions you can logically perform with them. But man, was OOP a metaphor without a country! The first three or four books I read on the subject all used the same incredibly-lame examples–mostly fruit and cars. Sure, it’s somewhat illustrative of the OO concept to say, “well, you can drive a car, but not a banana, so driving is a method of the object ‘car’.” It was literally years before you started seeing real-world examples in OO texts. Why did it take years to be able to say, “AccountBalance is a property of the object Customer, and GetCustomerBalance is the method to retrieve it?” I have no idea. Probably we were all just morons.

So anyway, when I saw “Ruby” jotted on a whiteboard in the company of things like PHP, Ajax and DHTML, how could I have known that is represented yet another attempt at the holy grail of 100% object orientation? But it is. And they’re serious about it. How serious? How about “In Ruby, the number 1 is an instance of class Fixnum.” Yeah, that’s heart-attack serious. I mean really, does the number “1” need to be an instance of anything? Even setting aside the overhead (both mental and computational) of the abstraction, the threat is that given this level of flexibility there lies somewhere down the line the temptation to override what “1” or “addition” or something equally fundamental about a “FixNum” means. And while I can see the value of this as an exercise in abstraction, as a thought experiment in the inherent existentialism of computer code, I’m not sure this is a neighborhood I want to inhabit. Because you very quickly end up in situations where your neighbor believes “gallon of milk” should mean “gallon of bleach,” and then you have to know who owns the grocery store this week before you make your shopping list. Because it’s pretty likely your idiot neighbor in this hypothetical OO hell also directed all “poison control” calls to the “dial a joke” object interface.

Leave a Reply

Your email address will not be published. Required fields are marked *