Hacker News new | ask | show | jobs
by pbourke 2022 days ago
> no one should spend his life picking up shitty code left by his elders decades ago.

Would you say that to a civil engineer who works on infrastructure maintenance?

Computing is critical infrastructure in many areas of government and business. The solution to all problems cannot be “screw it, we’ll just rewrite in Go with a React frontend.” Some things should be rewritten and some should be maintained.

2 comments

Have you ever worked on an IT infrastructure where there is no comments in the source code, no documentation, no normalization, no specs? I am not talking about COBOL itself, I am talking about those COBOL jobs, it's only about fixing and/or maintaining. I hope no one is writing new things in COBOL.
Back in the day... COBOL programmers were often 'analysts' as well - meeting with the end users and/or management to design and then implement the required system.

Funny to me how so many in this thread rag on COBOL, yet when other languages come up it is always 'well this language is good for abc but I wouldn't really do xyz in that one'. COBOL is extremely good at what it was designed for - data processing, and lots of it.

> COBOL is extremely good at what it was designed for - data processing, and lots of it.

Well, the hardware that COBOL usually runs on is good for that, sure. And its usually (now) running legacy systems that no one wants the risk of reimplementing from the ground up. But is the language itself particularly well-suited to the task? I think that’s less clear. Certainly, I’ve never seen a coherent argument about how the language itself is superior to modern alternatives even for large scale data processing; if it was, it would be popular for greenfield projects in that domain, you’d think.

One thing I have heard about COBOL is that it has a built in, decimal fixed point type. Very few of the modern languages have an native type like this. Having a decimal fixed point type makes monetary calculations easier to do more reliably.
> One thing I have heard about COBOL is that it has a built in, decimal fixed point type. Very few of the modern languages have an native type like this..

What modern language doesn’t have either fixed-point or arbitrary-precision decimals (or both) in either the core language or standard library?

I mean, sure, C doesn’t (and I don’t think C++ does), but those aren’t particularly modern languages.

In don’t think that Java fits the bill either in this regard. White it does have BigDecimal in the standard library, it is both slower(because object and supports arbitrary precision) and more cumbersome (no operator overloading ) than a native type.
I can see a case for decimal floating point types, but fixed point adds nothing beyond what can be performed directly via arithmetic on the underlying integers. It's basically a convenience feature.
Most things in modern programming languages are convenience features; loops are basically if+goto etc.
It's suited for a very specific kind of data processing. It's a kind which isn't typically used today.

The language combines presentation and storage in a way I've never seen in any other language. Let's say you have an 8 digit variable. You can then specify that the last two digits is represented by a different variable, and thus the second variable will only work on those last two digits.

This is useful when you have formatted fields, where you have a variable that holds an ISO 8601 date, with other variables representing the year, month and day parts.

In a language like Java, you need to create a class that holds this information, with separate methods to manipulate the individual components and formatting the output.

In COBOL you only need a few lines of declarations to do this.

The drawback is that now presentation is tightly associated with the data storage, meaning that changing presentation format can be a lot of work. This is why COBOL programs were so problematic during Y2K.