Why is COBOL still dominant?

Compared to common programming languages today, COBOL is different, and in some ways very limited: you can’t do dynamic memory allocation, you can’t easily access low-level features of the operating system or particular computer architecture. The most common forms of the language can’t use recursion. You’d never want to write a compiler in COBOL. A computer science student presented with COBOL would be appalled.

This is a category error. In modern terminology, COBOL is actually a domain-specific language, specific to the particular domain of business programming. Robert Glass identified specific ways in which COBOL is better suited to business programming than general-purposes languages, among them:

  • A business-oriented language needs to declare, manage, and manipulate heterogenous data. Business programs mix fixed and variable length strings, floating-point, integer, and decimal data with wild abandon in complicated record structures, often with variable parts. Database programmers are familiar with some of these issues, and object-relational mapping tools trip over these complexities regularly.
  • Business and financial data needs to be managed using true decimal data types. Accounting systems must be correct to the last decimal digit and need to reproduce exactly the results of hand-calculation; conventional floating-point numbers lead to complexities and errors.
  • A business-oriented language needs to access and manipulate large amounts of record-structured data maintained externally.

Now, none of this is beyond the capabilities of general-purpose programming languages, of course. But in COBOL, it’s native to the language.

We can debate the need for COBOL, but the fact is that hundreds of billions of lines of COBOL exist, and attempts to migrate away from COBOL have not generally been successful.


Comments

Leave a Reply

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