Monday, August 14, 2006

Programming languages and the zealots who love them

In the magazine American Scientist, computer columnist Brian Hayes has a fun overview of the world's many, many computer programming languages and the zealots who fight over which is best. He seems to know the field, and himself favors the obscure language Lisp, so it's strange that he gets object-oriented programming so wrong:
In object-oriented programming languages the root idea is to bind together imperative commands and the data they act on, forming encapsulated objects. Instead of defining a procedure to manipulate a data structure, one "teaches" the data structure how to carry out operations on itself.
I won't get into details about why this is wrong, but only promise that this makes absolutely no sense.

For an even more esoteric, but fun, journey through the state of programming languages, try Amazon employee Steve Yegge's 2004 rant "Tour de Babel":

We have 50 million lines of C++ code. No, it's more than that now. I don't know what it is anymore. It was 50 million last Christmas, nine months ago, and was expanding at 8 million lines a quarter. The expansion rate was increasing as well. Ouch.

Stuff takes forever to do around here. An Amazon engineer once described our code base as "a huge mountain of poop, the biggest mountain you've ever seen, and your job is to crawl into the very center of it, every time you need to fix something."

Blogger Jeff'y on Tue Aug 15, 09:03:00 AM:
Have you seen Execution in the Kingdom of Nouns? Some LISP folks at work (we have quite a few) were circulating that a while ago. It goes into (excruciating) detail on the noun-with-verbs indictment against object oriented programming, but I agree that the issue is overblown. Or maybe I just go out of my way to write functional Java code whenever I can.

Despite my (admitted) tendency to over-parenthesize my prose, everyone knows that Perl, not LISP, is the One True Language.
Blogger Ben on Tue Aug 15, 10:15:00 AM:
The noun-with-verbs quality of Object Oriented Programming (OOP) is one thing -- but the notion that somehow these objects float around independently and act as independent agents is another. When I was learning OOP, I found such metaphors to be overblown and actually a block to my comprehension of OOP concepts; why not just say that instead of defining a function called repeatUntilMatched anywhere, and then saying repeatUntilMatched(pattern), you make a file called pattern, put a function (why "method"??) called repeatUntilMatched in it because that's where it makes sense to go, and say pattern.repeatUntilMatched() ?

And talking about "teaching" objects to perform operations on itself is a fantasy at best. Nontechnical readers probably assume that Hayes is talking about some sort of artificial intelligence.