Glass Maze Every jumbled pile of person

Posted
10 January 2006

Tagged
Uncategorized

The Bewildering Longevity of COBOL

Back in the dim recesses of time a programming language named COBOL was born. It was a strange creature, built on ancient notions that, in the harsh light of the twenty-first century, seem as quaint and obsolete as those squat space-age concept houses that sprouted up in the sixties, all glass and metal and odd angles and strange layered roofs.

COBOL’s big idea was this: a computer language should resemble as much as possible human language, so that “managers and grocery clerks” could read it and write it. Pursuant to this dubious and quixotic goal, it uses “paragraphs” and “verbs” instead of “blocks” and “keywords”, and expresses itself in a bastardized approximation of English sentences. The result is a sort of clipped robot-speak syntax:

IF X EQUALS 3 OR 4
    ADD 1 TO X
    MULTIPLY Y BY 2
    MOVE SPACES TO S.

This syntax also happens to be ridiculously verbose, at least compared to modern-day languages. In Python, if you want to multiply two numbers and assign the product to a couple of variables, you’d do this:

foo = bar = 10 * 3.1415

Easy to read, not too difficult to understand. Here’s COBOL’s approach:

MULTIPLY 10 BY 3.1415 GIVING foo
MOVE foo TO bar

Hmmm. Pretty easy to read, I guess, and sort of English-y. But when I look at this, I don’t think hey, cool, easy to read! I think, hey, shit, hard to type! My carpal tunnel flares up just thinking about writing all that. This may be a godsend to programmers who get paid by the word, but otherwise it’s all purple prose and overwrought diction.

If C++ came up to COBOL to asked for direction to the nearest bathroom, the conversation would go something like this:

C++: me.hello(you)

COBOL: Greetings. How are you. It is a pleasure to make your acquaintance on this most auspicious of days, the day on which I have made your acquaintance. Hello.

C++: me.bathroom.directions = you.bathroom.directions

COBOL: It has come to my attention that you, C++, are seeking directions to the bathroom. The bathroom is where you wish to go. Extrapolating, I further speculate that a piss is what you wish to take in the bathroom to which you want to go.

C++: break

COBOL: An interrupt has occurred in C++’s request for a bathroom in which the piss that C++ wishes to take is to occur. The information that was previously requested will now be assigned to a global variable and kept in abeyance until such time as C++ …

C++: exit()

COBOL: … is ready to use the information which was previously requested on the subject of bathrooms in which various bodily effluvia may or may not be extruded via certain excretory apparatuses …

Of all the misguided efforts over the past several decades to make software easier to write, this notion that computer languages should be more like actual language is perhaps the silliest. Human language serves the human brian, a massive unkempt ganglionic supercomputer that is possibly the most complex entity in the universe — so complex that it doesn’t even understand itself. It can handle the maddening unspecificity, the sprawling chaos of our spoken languages — untangling idioms, parsing grammatical ambiguities, registering implicit connotations. English words can have many different and unrelated meanings, accreted over centuries of use. Our brains have to tease out the appropriate definition based entirely on abstruse factors like context and connotation and a priori knowledge of the speaker’s speech patterns. And even they don’t always get it right. This is not a good model for a computer language, which demands rigor and cannot bear ambiguity. We have a hard enough time getting programs right without having to worry about connotation and inference.

Ok. Fine. COBOL is easy to mock. We in the post-FORTRAN world are pretty much conditioned to mock COBOL. It’s domain-specific and verbose and overwrought, it’s antiquated and obsolete, it’s a shambling brontosaurus in a world of skittering raptors, blah blah blah. But the funny thing is … people are still writing COBOL. Lots of it. There are about 50 billion lines of COBOL floating around out there, with more added each year. It’s still happening. This says something about what passes for conventional wisdom in our industry, and about the danger of discounting the tried and true even in an field where every new advance has the lifespan of a fruitfly. But still, this just blows my mind. It’s sort of equivalent to hacking your way to the heart of a dark rainforest and finding not a small isolated tribe of men and women still using stone-age technology and listening to disco, but an entire civilization in this state. It’s the kind of thing that makes you question your basic assumptions about the universe.


7 Comments

Posted by
sahalie
10 January 2006 @ 12pm

one word popped into my head: C-3P0 you know, from star wars archaic and somehow enchanting in its English-butler-accented proper blathering not that i know anything at all about comfuser language but it sounds plausible?

speaking of, my Mom brought me a box of toys i’d had as a child and in the bottom of all the shtuff there was a little action-figure C-3PO, along with R2-D2, chewbacca, han solo, princess leia, luke, and also darth vader, who was missing his cape and looked very silly. these things are what, 20 years old? collectors items, surely.


Posted by
lapsed cannibal
10 January 2006 @ 12pm

sahalie – Cool! I had all that stuff too, plus a big-ass Millenium Falcon with a secret compartment for hiding from Stormtroopers. Definitely collector’s items.


Posted by
sahalie
11 January 2006 @ 3pm

damn, i wanted the millenium falcon i got a taun-taun instead and thought it would have been a lot cooler if it, too, had a secret belly-compartment so i could stuff luke skywalker into it, you know like in the empire strikes back when han solo rescues him


Posted by
Z
12 January 2006 @ 1pm

I always wanted an AT-AT (All terrain attack transport), you know the big four legged walker thing. Guess my parents couldn’t see themselves forking over what was most likely a rediculous amount of money at the time. Again, 25 years ago was a different time. Wasn’t like I was getting $400 XBox 360 gaming systems…of course I am not now either….


Posted by
lapsed cannibal
12 January 2006 @ 1pm

Z – Yeah, those huge AT-ATs rocked. Also the Rebels’ flying snowspeeder thingy, with the harpoon at the back. Good times.

By the way – you get 4000 geek points for knowing what at-at stands for. Outstanding.


Posted by
Z
13 January 2006 @ 9am

One more thought on the whole COBOL thing. I wonder if my suffering through that was cause for my attempt at writing the most logic with the fewest characters when I learned FORTRAN, C and C++? I guess I finally grew out of it with Java. Others may disagree…


Posted by
Alan
28 April 2007 @ 4am

Your Python may be easy too read, but it looks like it is too hard for you to understand:

foo = bar = 1 creates two references to a value. Not two variables.

Turns out programming languages can bear more ambiguity and and imprecision than you think !


Leave a Comment