The Greatest Invention in Computer Science

Umm… Could you define “routines”?

As far as I can tell, sub-programs have been around almost as long as computers. I use to program sub-programs in assembly language. I had them in Fortran and Cobol. Heck, I can’t think of any language I had that didn’t have some concept of a gosub or function. (Well, APL didn’t, but you could never read what you wrote anyway).

To me the big change was the localization of variables. Older languages didn’t have THAT concept. For example, in the early 1980s and late 1970s, I use to write in a proprietary language called Cadol. Cadol didn’t have variables, but registers. Some registers could store alphanumeric data and some numeric data. Basically, all registers are global from boot up until you shut down the machine.

We had sub-routines, but we didn’t have local variables. To get around this issue, we divided the registers up into “used to store data” and “used by sub-routines”. When you call a subroutine, you’d copy the necessary “used to store data” registers to the “used by sub-routine” registers, call the sub-routine, and then copy the “used by sub-routine” registers back to the “used to store data” registers.

When I learned Pascal back in the mid-1980s, I was awe struck at the concept that functions and procedures had local variables. That was a great revelation and made programming much, much easier to do.

I think Fortran II (1958) was the first language to have procedures, but I don’t remember if these procedures had local variable space or not. I don’t think it did.