well-written COBOL reads like an English novel

Story: COBOL turns 60: Why it will outlive us allTotal Replies: 7
Author Content
gus3

Sep 06, 2019
5:03 AM EDT
I lost an earlier, longer comment, so here's the condensed version:

In Pascal: "a := b * c ;"

In BASIC: "LET a = b * c"

In COBOL: "MULTIPLY B BY C GIVING A."

And for the pedantic:

In Scheme: "(set! a (* b c))"

Finally, in Forth: "b @ c @ * a !"

-----

Each statement accomplishes the same thing, but which one requires the least translation as you read it out loud? I'd argue that COBOL very nearly approaches that goal.

COBOL is to computing languages what RISC is to processor design, a hard application of the KISS principle: "Keep It Simple, Stupid!". The design philosophy of COBOL is to lay out the data structures explicitly, in order to simplify the code.

"Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won’t usually need your flowcharts; they’ll be obvious." - Fred Brooks, The Mythical Man-month
penguinist

Sep 06, 2019
5:22 AM EDT
Forth is a language that I still fondly remember. I loved the logic of Forth, maybe its appeal resulted from it's similarity to my calculator of choice at that time, an HP35.
bverheg

Sep 06, 2019
6:34 AM EDT
When COBOL appeared there was already FORTRAN. And it had the simplest assignment statement that you can dream, inherited by C and Python and many others: "a = b * c" It takes me 100x more time to understand the COBOL statement. I guess COBOL was only meant for people that have no mathematical knowledge.
arm

Sep 06, 2019
7:54 AM EDT
I find the less 'wordy' versions better. I want to know what a bit of code is doing at a glance, not have to read a chunk of prose to get gist.
cr

Sep 06, 2019
11:51 AM EDT
@penguinist: Different strokes, I guess... I still use HP's RPN -- if I'm not invoking gdcalc on the KDE1.1 box, I'm pulling down my HP-11C or HP-41CV (long before the Turbo-C or Perl5 versions, I wrote the first version of ampsr that had standard-values search on the HP-41CV) -- but Forth has too little syntactical sugar and too great a head-context load, particularly for stack operations, for my tastes. The least little distraction or social interrupt leaves me having to rebuild my visualization of the data from scratch. Do you live alone?

@arm: I share your distaste for wordy languages: it's too hard to pick out the chosen words (variable names, immediate constants, strings) from the language mechanics. C > Pascal for that reason alone.
gus3

Sep 06, 2019
9:19 PM EDT
bverheg wrote:I guess COBOL was only meant for people that have no mathematical knowledge.
That was a major factor in the design of COBOL. It was designed in part so that executives, who weren't necessarily computer programmers (but could read English!), could look at the code and see what the machine was accomplishing. The target audience wasn't the scientists, but rather the business leaders. Hence the acronym: COmmon Business Oriented Language.

The only adjustment I'd make to the above quote, is to change "mathematical knowledge" to "knowledge of Turing machines". COBOL first appeared five years after Alan Turing died, so thinking of computers as Turing machines was still very common. Most business executives had no training in using Turing machines or symbolic computation, so COBOL was an easy way for them to read the "effective method" without formal training in the underlying theory.
mbaehrlxer

Sep 09, 2019
3:53 AM EDT
cobol was of course designed to read like english. the problem with that is that english was not designed to express complex mathematical and programmatic statements.

in other words, things that are easy to express in english, are also easy to express in cobol, but programs of more significant complexity became extremely hard.

greetings, eMBee.
telanoc

Sep 17, 2019
1:16 PM EDT
And one way in lisp: (setf a (* b c))

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!