by Gideon Marcus
A Matter of Time
We are now in the latter half of the 1960s, and computers have become a fundamental part of our lives. I previously discussed how computers are really quite simple, only understanding ones and zeroes. And yet, with a bit of ingenuity and a lot of patience, a computer can be instructed ("programmed') to do almost anything.co
Patience is the operative word. As we saw last time, when programming in a language the computer understands natively, it takes six lines of computer language ("code") to add two numbers, and thirty just to have the computer use the Pythagorean Theorem to determine the hypotenuse of a right triangle. Can you imagine doing advanced trigonometry that way? Simple calculus? How about advanced calculus?
If you're a scientist, you probably know advanced mathematics, but it's unlikely that you have any idea how to write machine language code. And given that every computer speaks its own version of machine language, you certainly couldn't be expected know how to speak to all of them in their native tongue.
But if you've got a thorny problem to solve, and the math is too complex (or more importantly, time-consuming) for you to handle on your own, you've got to be able to use a computer. At that point, given the tools we've got thus far, your only option would be to employ a human translator to convert your problem into something the computer can understand.
People like this don't grow on trees! It's not as if there are freelance software programmers out there who will take a coding assignment like piecework. Computer tenders are full-time personnel employed by the institution that bought the machine. Their time is precious. They can't afford to write thousands of lines of program code every time an egghead wants to run a Fourier Transformation. Moreover, they probably aren't scientists: would a computer gnome even know linear algebra from a serial circuit?
What's needed is a machine to talk to the machine.
A Language is Born
In 1954, a ten-person team led by IBM engineer, John Backus, developed the first robot translator. Backus wasn't interested in plane tickets or phone bills; he simply wanted it to be easier for scientists to run math equations on a computer. Sophisticated business applications could come later.
John Backus
Lois Habit, the lone woman on the team
Backus' team created FORTRAN: Formula Translator. And it sparked a revolution.
FORTRAN actually comprised two elements: a new programming language for humans and a robot middleman for the computer.
First, the language. FORTRAN, like any language, has a grammar and a vocabulary. There are dozens of words, all of them more or less recognizable to an English speaker, though their definitions are highly specific. Also, they must be entered in a grammatically rigorous fashion for them to work.
But once one gets the knack, its orders of magnitude easier to program in FORTRAN than machine language. For example, last time, we saw it took six lines of code just to add two numbers, and we had to include the numbers as part of the program. What if we wanted a general program to add any two numbers?
It'd look like this:
PROGRAM ADD
C This program will add two numbers
INTEGER FIRST, SECOND, TOTAL
10 FORMAT(I5)
20 FORMAT(I6)
READ (5,10) FIRST
READ (5,10) SECOND
TOTAL = FIRST + SECOND
WRITE (6,20) TOTAL
END
Even without explanation, you probably were able to figure out how this program works, but here's some extra information:
Every FORTRAN program starts with PROGRAM (followed by the program's name) and ends with END. At the beginning of every program, one declares their variables, informing the computer how to label any data it manipulates. In this case, we're playing with integers, but variables can be real numbers or even strings of text. FORMAT tells the program how many digits the variables can have (in this case, up to five for entry, six for the total).
When a line starts with a "C", any comment (generally explanatory) may follow. What a boon for error-checking ("debugging") that is!
If you are lucky enough to have direct keyboard access to the computer to enter ("READ") the numbers to be added, and a CRT monitor on which the computer can display ("WRITE") the results, the interaction after the program is run will take seconds. If you have to enter information with punch cards and view the results via printer, things will take a bit longer (and the numbers in the parentheses will be different). But that's a topic for another article.
The whole program takes just 10 lines, one of which is optional. Sure, it's half again as long as the equivalent machine code, but it can add any two numbers rather than two pre-coded ones.
Not only that, but that thirty line Pythagorean equation program can be done in just ten lines, too! That's because FORTRAN includes a SQRT (square root) command. Better still, there are commands for every trigonometric function (SIN, ASIN, COS, ACOS, etc.) so with just a few more lines, you can also get information on any triangle using the Law of Sines and Law of Cosines.
Now you can see just how powerful a programming language can be!
Robot Middleman
Every computer comes with a kind of translator already hardwired into its permanent memory. Otherwise, it couldn't interpret (for example) 101 as "Add" and 111 as "Print". But, as we've discussed, they are incredibly minimal. For a computer to understand the language of FORTRAN, it has to be programmed with an extra translator called a compiler.
The compiler is a program input into the computer in machine language, of course (how else could it understand it?), but once entered, the compiler can be run to translate any FORTRAN program. The compiler will completely translate ("assemble") the FORTRAN commands into a machine language program and execute it.
This process is not instantaneous, just as a conversation between two people using an interpreter requires extra time. Moreover, the compiler-assembled program is generally not as efficiently written (i.e. it takes more lines of code) as one optimized for brevity by an expert human.
But because one saves so much time coding in FORTRAN, and because a human machine language expert isn't needed, the result is a tremendous net increase in efficiency. In fact, programmers have been 500% quicker in their coding as a result, and they can focus on the problem they are trying to solve rather than the daunting task of talking in ones and zeroes or some arcane machine language. That's worth the small price in computing time inefficiency.
Programming for everyone
FORTRAN was the first "higher-level" programming language, but it was quickly joined by many others. They include LISP ("LISt Processing"), COBOL ("COmmon Business-Oriented Language"), and ALGOL ("ALGOrithmic Language"), each with their own specialized vocabulary and capabilities. Indeed, it would be no exaggeration to say that a computer that can't read a higher-level language is almost useless; it's no surprise that FORTRAN was developed less than a decade after ENIAC, the first computer, came on-line.
But, as amazing as all of these languages are, their usage remains daunting. FORTRAN et. al. are very good for the applications they were designed for, but not terribly flexible for anything else.
What this means is that, while FORTRAN might be useful to a physicist for making mathematical calculations, and COBOL is great for a corporate engineer to automate inventory control, there is no language for general application. No introductory computing language that one (say, a college student) might learn to familiarize oneself with the theory of higher-level programming.
Moreover, most people don't have direct access to a computer, which means laboriously using a keypunch machine to put holes in punchcards (with one line of code per card), giving the stack to a technician, and waiting who-knows-how-long to get a result.
The stage has been set for a simpler, even higher-level programming language that will allow anyone to dive feet first into coding — and that's basically what we'll be talking about in the next article in this series.
Your code does not look the Fortran 4 which I once knew in maybe 1966. For example to print integer "K" you would have to use something like:
WRITE(6,88) K
88 FORMAT( I8 )
Where the 6 is the channel for the printer, 88 is the line ID of the format for the WRITE statement, "I8" means to print the "K" integer as 8 characters wide, Something like that anyway.
A simple 'PRINT' would not do.
I must have been looking at someone's wish-list design paper! I think I've got proper code now — per FORTRAN IV (which came out in 1963).
Thank you for your (no pun intended) input!
My first programming language was Fortran, first computer an IBM 1620. First programs written on punch cards as shown. 1966. So much fun.
I'm still at it, about a dozen languages later, having fun on my Mac with C, Objective-C, C++, Bash, AppleScript, and even 86_64 assembly language.
Wrote software for a living for a while, which sucked. Corporate pressure took all the fun out of it. Glad I quit the profession.
71 years old and still a codin' fool.
Thank you, Howard! Glad to bring back memories and that I conveyed the art accurately (after a little nudging and research)
I can say I took FORTRAN 77 the very last semester it was ever offered at Colorado State U. -Spring ‘92.
More programmers in the future! I'm glad FORTRAN will live so long…