Live data from Hacker News

COBOL: Thinking about it wrong

gcn.com

71–80 of 116 posts

Re: COBOL: Thinking about it wrong

#71
My mom learned COBOL while she was getting a degree in accounting; according to her, the language is such a clear mapping from narrative jargon usage in accounting and bookkeeping that she was using features her class hadn't covered, in test solutions, without realizing it, until her teacher asked if she was studying outside materials.

My conclusion was, if ever I want to do business data (transaction) processing, I'll learn it.

I also programmed a mainframe, with JCL on punch cards, in assembler and PL/1, in college; I'm glad I did; without that experience it might be hard to appreciate how radical and revolutionary unix was.

Re: COBOL: Thinking about it wrong

#72
I grew up hearing COBOL as a joke language, until one day, I learned that COBOL has the most accurate arbitrary precision math, surpassing modern languages. This is crucial for financial applications. When I then think about how it doesn’t seem any more verbose than SQL, COBOL seems to me like a very respectable language.

Somewhere early in my career, I worked with an accounting app that thought a double float is good enough for a ledger. It was not. We spent too much time trying to track down discrepancies when closing the book for the year, only to find out that a double float is not precise enough for bookkeeping. Lesson learned.

Re: COBOL: Thinking about it wrong

#73
post #72

I grew up hearing COBOL as a joke language, until one day, I learned that COBOL has the most accurate arbitrary precision math, surpassing modern languages. This is crucial for financial applications. When I then think about how it doesn’t seem any more verbose than SQL, COBOL seems to me like a very respectable language. Somewhere early in my career, I worked with an accounting app that thought a double float is goo…

> I learned that COBOL has the most accurate arbitrary precision math, surpassing modern languages.

Maybe that was true 20 years ago.

Re: COBOL: Thinking about it wrong

#74
post #72

I grew up hearing COBOL as a joke language, until one day, I learned that COBOL has the most accurate arbitrary precision math, surpassing modern languages. This is crucial for financial applications. When I then think about how it doesn’t seem any more verbose than SQL, COBOL seems to me like a very respectable language. Somewhere early in my career, I worked with an accounting app that thought a double float is goo…

> I learned that COBOL has the most accurate arbitrary precision math, surpassing modern languages. Maybe that was true 20 years ago.

It was not, but for the most part languages don't default to arbitrary precision (i.e., sinple mathematical operators with decimal literals typically gets you binary floating point, not arbitrary precision decimal), even if they have arbitrary precision available at the language or standard library level.

Re: COBOL: Thinking about it wrong

#75

I have seen the COBOL issue come up a number of times, and I just don't get it. Am I thinking about this wrong? COBOL seems to be a straightforward language by modern standards. Any programmer with experience with imperative languages should be able to pick it up. Learning the language itself cannot be a real barrier. The barrier seems to be the enormous amount of legacy code that has to be digested and understood. B…

data definition syntax is quite strange at first but conceptually there's nothing special

and yeah legacy code of really sauron like

Re: COBOL: Thinking about it wrong

#76
This article is extremely disingenous.

* Can you build "modern" style software in COBOL? - Sort of yes.

* Should you build a new system today using COBOL? - Absolutely not.

* Is ANY of the COBOL code you run into in the wild going to be architected in a recognizable way to modern sofware engineers? - lol no.

Re: COBOL: Thinking about it wrong

#77
post #6

People that have not been exposed to legacy industries (banking, insurance, etc) would simply not believe how many of these large/huge companies run the majority of their business on an IBM mainframe running COBOL code. I've seen it firsthand and I didn't believe it. For them, it just works.

Its peak hacker news to come up with a term like "legacy industry".

I suspect they mean "systems that use a lot of legacy technology" rather than "banking and insurance are legacy business models", but it is HN, so who knows. Either way, pretty amusing.

Re: COBOL: Thinking about it wrong

#78

I have seen the COBOL issue come up a number of times, and I just don't get it. Am I thinking about this wrong? COBOL seems to be a straightforward language by modern standards. Any programmer with experience with imperative languages should be able to pick it up. Learning the language itself cannot be a real barrier. The barrier seems to be the enormous amount of legacy code that has to be digested and understood. B…

I only have minor experience with COBOL, but in my mind the issue is that those 800 million lines of code don't have a single unit test, because testing COBOL is really hard. Which makes it dangerous to do any refactoring.

Specifically the snippets I've seen do some in-line SQL to get its data, some business logic and then updates. The logic is rarely in a procedure that takes parameters, because that doubles the number of lines of code you need. So the only way to test it is to bring up a database, insert some test data, assert and clean up the database again. Which is a lot harder since "insert some test data" gets complicated because of different constraints and triggers etc. Then running it regularly is harder than it should, there's no SQLite equivalent database so you typically need to run it on a mainframe etc.

I've worked on replacing a piece of functionality from COBOL to Java, and I was working from the business requirements that was basically a large spreadsheet of conditions and results. E.g. if age > 67 and not retired but have more than 3 kids, etc then this value. The code I wrote was gnarly because of all the combinations of different conditions, nested ifs 3-4 layers etc. And then there was ambiguity if multiple conditions hit, which one took precedence. I asked if I could look at the equivalent COBOL and the actual logic was about 10 lines long (not including headers, comments etc). Wish I had seen that before I started coding. It was quite readable and well commented too. So the actual language isn't _bad_, but the lack of tooling around it is severely lacking.

Re: COBOL: Thinking about it wrong

#80
post #63

COBOL (COmmon Business-Oriented Language) was designed by Grace Hopper to make it easier for business folks to write code. https://www.zdnet.com/article/cobol-grace-hoppers-gift-to-th... That goal a flop, so programmers had to take over. Wasn't there a Cucumber/Gherkin story here really recently? That grew out of Fit/Fitnesse (from Ward Cunningham of "tech debt" and "the wiki" fame), which was intended to have busine…

> COBOL was designed by Grace Hopper to make it easier for business folks to write code.

Not quite; it (FLOW-MATIC, rather) was designed so that senior management could feel that they could read their organization's code.

> I suggest a reply to those who would like data processing people to use mathematical symbols that they make the first attempt to teach those symbols to vice-presidents or a colonel or admiral. I assure you that I tried it.

Post reply on HN