
Ask HN: Why Did COBOL Die? - _bxg1
You don&#x27;t see many programming languages that simply drop off the map. Even those whose heydays have passed, like Lisp and Fortran, tend to retain niche communities over the decades and get used at the occasional company.<p>But COBOL is <i>dead</i> dead. Nobody writes it as a hobby. No company builds new projects with it. It&#x27;s 100% in maintenance mode.<p>What happened that caused that?
======
coder4life
It's horribly verbose. It's slow a molasses It reminds you when looking at it
that it's from the 1970s. All the applications have ever been business.
Where's the fun in that?

I learned it in High School, and had to read it on a couple jobs while we were
transitioning to another language (probably RPG/III, another dead dead
language)

------
simonblack
COBOL was unstructured. Not like (say) C or Pascal.

Modern languages are structured. Older languages like COBOL or BASIC, being
unstructured, lead to what used to be called 'spaghetti code'.

[https://en.wikipedia.org/wiki/Spaghetti_code](https://en.wikipedia.org/wiki/Spaghetti_code)

Unstructured code was deprecated in the 70s and 80s after the famous 'GOTO
considered harmful' paper by Dijkstra.

[https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.p...](https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.pdf)

COBOL's other 'drawback' was its verbose code. I use 'drawback' in quotes
because I always found that its verbose nature meant you could pick up a COBOL
program that you hadn't looked at for six months and immediately know what was
going on.

example:

    
    
        ADD WORK-HOURS TO OVERTIME-HOURS GIVING TOTAL-WEEK-HOURS.
    

rather than

    
    
         z = a + b;
    

Although, because of my COBOL experiences, I tend to do something like this:

    
    
         total_hours = work_hours + overtime_hours;
    

which is more wordy than normal C but more terse than COBOL.

~~~
_bxg1
C has goto, as does C#. Using it is frowned upon, but it's there. I'm not
familiar with the term "unstructured" in this context; does COBOL not have
subroutines or something?

And I'm sure COBOL's verbosity can't hold a candle to enterprise Java.

I'm still not seeing a single big factor that sets it apart as unusable. All
languages have flaws.

~~~
simonblack
Non-structured programming relies on GOTOs. While some unstructured languages
(e.g. BASIC, COBOL) _do_ have subroutines, in general the program-flow goes
all over the place.

Structured languages rely more on 'if-then-else', 'do-while' or 'case' types
of flow controls, where there is a constricted number of flows available.
Coming from BASIC as my first-learned programming language, it took me a lot
of effort to re-arrange my programs to eliminate all GOTOs.

If your code does not need to use a GOTO, it's flow _is_ structured, and you
have learned subconsciously (or you were taught) how to write structured
programs rather than unstructured programs.

I once saw a diagram that showed how the program-flow formed nested loops in
the code. The idea was that the program-flow should be written so one loop
does not cross over another flow-line loop. The cartoon here (
[https://encyclopedia2.thefreedictionary.com/Spaghetti+progra...](https://encyclopedia2.thefreedictionary.com/Spaghetti+programming)
) shows the crossing of flow-lines.

------
kazinator
COBOL missed the vast market of small to mid-size businesses computerizing
themselves with the emerging PC. It failed to migrate to microcomputers, and
had its lunch eaten by the so-called "4GL" languages such as Ashton-Tate's
dBase and its descendants and imitations collectively known as "xBase"
(including Clipper, FoxPro and such).

[https://en.wikipedia.org/wiki/Ashton-
Tate](https://en.wikipedia.org/wiki/Ashton-Tate)

dBase programmers in the 80's were basically the target market for COBOL: in-
house business applications built around a database, with a bit of UI.

In some ways dBase was the COBOL of the microcomputer revolution. It's
similarly obtuse; it has all the appeal of COBOL.

[https://en.wikipedia.org/wiki/DBase#Programming_examples](https://en.wikipedia.org/wiki/DBase#Programming_examples)

