← Back to context

Comment by owenthejumper

24 days ago

Roast me but the code is very readable. Compare with some modern languages where you have to stare at it for minutes to understand what's going on.

I once worked at a FAANG company where I had access to some of the leading C++ experts in the world (some were part of the international language committee). I emailed an internal C++ list asking whether a certain line of code would create a memory leak. It was a pure use of STL templates and casting. The experts could NOT agree whether I was doing it correctly. Some expected a leak, others didn't.

This true little story says everything about C++. JavaScript is full of these things too.

  • That’s every language. Experts will argue and pontificate the nuances of each branching instruction.

    • But they all should agree on whether a certain line is correct (ie causes a memory leak).

That was always it's strength. I started programming in 1976, trained in COBOL and ICL PLAN, used punched cards, and mop terminals once we got out of training. 100% of our programs were batch programs. There was a huge bias towards readability, so that anyone of us could read the source code and understand it. That readability was offset somewhat by the necessity to read and understand the core dumps produced when a program failed. At best you would be able to trace a failure to a specific line of code. Thus the habit of dry running programs was hard wired into you. When I left the government institution to move into commercial programming,it was still COBOL and batch programs until the early 80s.I spent 3 years on overnight support and that was when COBOL proved it's worth, you could pick up any previously unseen listing and the core dump and usually fix it pretty quickly, caveat it was always a tactical fix.

That’s why I like Ada (and VHDL). Somewhat verbose, perhaps, but much more readable than more “modern” languages.

  • As a teenager I swore by Turbo Pascal's begin/end syntax and C++ at the time, with its overloads and macro system was just noise to me.

    Many years have passed since but C++ with its overloads and macro system is still largely noise to me.

    • Overloading can be easily abused, but the very complicated expressions that can appear in programs for scientific/technical computing are immensely more readable when using operator overloading like in C++ instead of using named functions, like in languages that forbid operator overloading, e.g. Java.

      In scientific/technical computing you have frequently, even in the same expression, dozens of different kinds of additions, multiplications, divisions, etc., between scalars, vectors, matrices, tensors, complex numbers, various kinds of physical quantities, and so on. Without operator overloading the expressions can become huge, extending on a great number of program lines and they can be very difficult to understand.

      Also, Pascal's method of using a single kind of statement brackets, i.e. "begin" and "end" (renamed in C as "{" and "}"), which has been inherited from Algol 60, is wrong for program readability.

      The right method has been introduced by Algol 68 and it was inherited by languages like Ada. In such languages there are several kinds of statement brackets, like in the UNIX shell, where "if" and "fi" are brackets for conditional statements, "do" and "done" are brackets for loops and "case" and "esac" are brackets for selection statements. This is much more readable, especially when there is a big loop that can not be seen in a single page of code, so you see only its end, which is also the end of many other kinds of program structures, like nested loops, conditional statements or selection statements.

      To get the same readability in languages like Pascal and C, you can add comments to the final braces or "end" of the program structures, but this is much more cumbersome than in a language with several kinds of statement brackets, where the bracket pairs will normally be added automatically by your text editor.

      4 replies →

  • VHDL has special place in my heart coming from FPGA world. Oddly enough, I never thought of Ada and VHDL as similar, mhhmmm.

COBOL was designed to be written and read by non-programmers. That was the theory, at least.

  • And let’s not forget, so was FORTRAN. (Programmers coded in Assembler back then.)

    • Fortran (FORmula TRANslation) was intended for a very peculiar subset of 'non-programmers': mathematicians, engineers and the like. It ends up being a pretty good impedance match for people who are use to dealing with terse forms of expression already.

      1 reply →

MOVE FUNCTION MIN(BLOCK-ENTRY-MINIMUM-STATE-ID(LK-BLOCK), STATE-ID) TO BLOCK-ENTRY-MINIMUM-STATE-ID(LK-BLOCK)