Why COBOL doesn’t cripple the mind

I teach a course on legacy programming. More on that in a later post. One of the languages taught in that class is Cobol. It’s been around for over half a century and yet very few institutions teach it anymore. In most students eyes, Cobol is a mythical entity, some language that was supposedly used in the dark ages of programming, supplanted by C and Java. Not used in industry – a dead language. It was Dijkstra who in the 1970s said “the use of COBOL cripples the mind“.

The truth of course is much different. COBOL supports 90% of Fortune 500 business systems everyday and 70% of all critical business systems are written in COBOL. We can’t live without Cobol, and it’s not going away anytime soon. Oh sure, some systems can be re-engineered using other languages, but for the most part it is just too cost prohibitive. Look at how much Y2K cost to change a 2-digit date to a 4-digit date and deal with some leap-year issues – roughly US$300 billion.

One thing I found very interesting is that many students immensely dislike programming in Cobol. Comments are often along the lines of:

“I hate this language so much.”

Why do they hate the language so much? Partially of the reason is the English-like syntax. Students have a hard time dealing with it, they are use to programming in one of the C-family of languages: C, C++, C#, Java etc. Most have never programmed in the likes of Fortran, or Ada, let alone Cobol. It becomes even more challenging with older Cobol code that needs to be re-engineered. For example, consider the following code in a C-based language:

tax = rate * income

In Cobol this becomes either one of:

multiply rate by income giving tax.
compute tax = rate * income.

Also data has to be specified exactly. Coding something like

77 sumtotal pic 99.

means you can store the values 0 to 99. No negative numbers, and nothing larger than two digits – there is no facility to store them. There is also minimal modularity, nearly all variables are global, no pointers, minimal built-in functions. Should I go on? There are of course many positives – e.g. file handling is a breeze. Does it cripple the mind? Hardly. It just requires thinking a little differently about the syntax of the language.

Re-engineering Cobol code is expensive, tiresome, and may not be as much fun as designing a mobile app. But want a guaranteed job for the foreseeable future? Learn Cobol.

Cobol is very much alive for being a dead language.

Oh, and learn a pattern parsing language such as awk while you’re at it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s