This story was written by Keith Dawson for UBM DeusM’s community Web site Develop in the Cloud, sponsored by AT&T. It is archived here for informational purposes only because the Develop in the Cloud site is no more. This material is Copyright 2012 by UBM DeusM.

Religion and Object Orientation

The debate over OO's fundamental nature and usefulness is resurgent.

Debate over OO programming vs. procedural, functional, or other patterns flares up from time to time. This is one of those times.

This latest round was ignited by an essay by James Hague, titled "OOP Isn't a Fundamental Particle of Computing." (We were introduced to Hague in the inaugural edition of the Friday Four, where he asked a question that kicked off a lively debate here and elsewhere: Do you still want to be programming when you are 50?) Hague doesn't offer any sort of point-by-point argument as to why OO should not be considered fundamental; he simply states the conclusion he has arrived at thus far in his career:

[O]bject-oriented programming isn't the fundamental particle of computing that some people want it to be. When blindly applied to problems below an arbitrary complexity threshold, OOP can be verbose and contrived, yet there's often an aesthetic insistence on objects for everything all the way down. That's too bad, because it makes it harder to identify the cases where an object-oriented style truly results in an overall simplicity and ease of understanding.

What exactly do we mean by "object orientation?" There has been a notable lack of clarity on this question for 25 years. In 2001 or 2002, Paul Graham wrote an essay titled "Why Arc Isn't Especially Object-Oriented." (The date is not simple to pin down because Graham's essays are not dated. Arc is a dialect of Lisp that he developed.) That essay, and especially a concurring response to it by Jonathan Rees (which Graham also published), lays out some of the things people mean by OO.

Graham claims that "there are five reasons people like object-oriented programming, and three and a half of them are bad." Rees cuts the OO pie into more slices, outlining nine characteristics that various parties apply in various combinations to characterize OO: "Those who say Lisp is OO... mean {3,4,5,7}," and "Java is supposed to be OO because of {1,2,3,7,8,9}." That sort of thing.

The debate that Hague's essay initiated has been playing out on Hacker News, Google+, and other tech venues over the last few days. The Hacker News discussion is the deepest and most thoughtful. Someone whose nickname is "programminggeek" opines, "[M]ost OOP isn't object oriented at all, it's class oriented... [i.e.] most of the time OOP is used as containers for data and function, not for things." And "bad_user" makes this more particular by adding, "Most people that have a problem with OOP are conflating it with how OOP gets used in Java." Paul Graham may well agree with the latter sentiment; he wrote a decade ago that OO "is popular in big companies, because it suits the way they write software. At big companies, software tends to be written by large (and frequently changing) teams of mediocre programmers."

We met Rob Pike in a recent Friday Four. Pike used his Google+ page to comment on Hague's piece, while tearing down a rather polemical screed on the nature of OO from the year 2000. Pike muses on the recent resurgence of defenders of procedural programming, "perhaps it's just that the old guard is reasserting itself." His post has gathered 92 comments at this point.

OO programming isn't going away. But no matter what programming style we prefer, we can all benefit by stepping back from time to time and thinking a little more deeply about the nature of the way we are structuring code.

Related links