2.4: A Code Library

To understand the next advancement in computer programming, our story continues right where it left off...

Howard Aiken Delegates

Once Howard Aiken built the Harvard Mark I, he needed to put together a team of people to operate and maintain it. The machine was going to be used to calculate all kinds of things for the war, such as the artillery gun tables mentioned in the last section, as well as rocket trajectories, proximity fuses, radio wave propagation, ship hull design etc, so he needed a dedicated group of specialists running the machine.

They needed to be mathematicians who would know how to do the calculations, but also people who would be capable of operating the vast amount of controls that encompassed Mark I. And because the Mark I was a military secret, they would already have to be in the navy to be allowed to see it.

And so he recruited a newly graduated Navy Lieutenant - Grace Hopper.

Who Was Grace Hopper?

Grace Hopper. Image released by Miss Karen under the Creative Commons Attribution 2.0 Generic license.

For ten years, Grace Hopper had been a math teacher at Vassar College in New York. She was married to a New York University professor called Vincent Foster Hopper but they did not have any children.

In 1941, Grace had a personal crisis. She and her husband were going through marital problems and she wasn't able to get much support from her family because most of them had joined the military in order to help win the war. This left her unhappy in her personal life as well as experiencing feelings of guilt for not helping out enough with the war effort herself.

Then in December of that year, the U.S naval base Pearl Harbor was attacked, without warning, by Japanese forces. The attack killed more than 2,400 Americans. For Grace, this was the final straw. In 1943, she made the decision to leave her husband and join the navy.

Upon graduating at the Navy's training academy, her superiors saw how talented she was at mathematics and ordered her to Havard to work alongside Howard Aiken on the Harvard Mark I.

One Of A Kind

Grace Hopper was exceptionally talented and was not only able to formulate the mathematical equations that needed to be fed into the Mark I, but also operate the machine itself, translating those formulas into the punched card format required by the machine. She did this by spending an extraordinary amount of time and patience understanding how the machine worked once she joined the team.

Her level of talent for both areas was very rare. Most of the people on her team seemed to either fall onto the “math” side: good at putting together the arithmetic formulas, or the “machine” side: people who were good at operating the Mark I by punching holes into the right places in the card and feeding them in.

Not many people could do everything like Grace could, and this became a problem as more work came in and they needed to expand the team. People as talented as Grace were rare because not many math professors were willing to join the Navy, and not many Navy personnel were willing to learn math at a professor grade level. To avoid spending years trying to find more people like herself and risk prolonging the war, she came up with an idea that would allow both types of people to work together more smoothly.

A Shared Language

To solve the problem of different people having different skills, she proposed that both sides agree upon a common language, or “code”. The mathematicians could write down all their instructions in this special code, making sure that everything they needed was captured on a piece of paper, and then pass this piece of paper to the operators, who could use it to prepare punched tape for the Mark I.

This code would be similar to plain English, but would allow for enough technicality to articulate the exact math required for a calculation.

By capturing the instructions in this way, it meant that the mathematicians only had to learn how to write the code, while the operators only had to learn how to read it. The mathematicians didn't need to know anything about how the machine worked, and the operators didn't need to know anything about how the math worked.

This made it much easier to recruit people because they could be brought on as either a mathematician who writes codes or an operator who reads them. The military rank of these two roles was established so that coders were considered officers while operators were enlisted personnel. The coders were higher rank.

This allowed the team to produce results much faster as they were working more efficiently. Their efforts combined with those of all the allied militaries paid off and the war was won in 1945. Grace remained part of the team until her military contract expired in 1949.

With the war long over but the computing industry just beginning, Grace moved on to a company called the Eckert–Mauchly Computer Corporation, who focused on building civilian computers for the purpose of business. She took with her all of her wisdom and ideas gained from programming the Mark I.

Compiling Common Code

Grace was able to continue to develop her ideas in a new environment at Eckert–Mauchly, who had their own computer that they called the UNIVAC I (Universal Automatic Computer I). Its major advantage over the Mark I was that it used magnetic tape instead of punched cards.

The programming process was pretty much still the same, except instead of poking physical holes through cardboard, dots were essentially printed onto magnetic tape. It achieved the same thing because the dots on the magnetic tape could still be read by a machine, but the tapes were much smaller than the cards so the programmes were much easier to store and move around.

Grace Hopper operating the UNIVAC I. Image released by the Smithsonian Institution under the Creative Commons Attribution 2.0 Generic license.

With the stresses of the war over it was easier for Grace to think bigger and get more creative. In 1951, she presented her latest and biggest idea to the company. This idea shaped how computer programming is done to this day.

Grace realised that whenever they needed to code a particular mathematical function, they were putting the exact same code into the UNIVAC each time. This meant coding the tape in the same way each time. They had to do it this way because different problems often required functions to be run in different orders and combinations. The UNIVAC could only read one reel of tape at a time, so duplication was necessary in order to make one reel of tape that had all the functions running in the correct order.

Grace proposed that the UNIVAC should have its own internal library of commonly used code. They could make one single tape containing all the common mathematical functions and keep it permanently inside the UNIVAC. Then when they made their new tape for a specific programme, and it needed to use one of those functions, it could simply give the UNIVAC an instruction to look it up in the library. This meant that the tape being fed into the UNIVAC only had to contain a reference to the common piece of code, rather than all of the code itself.

This allowed the programme tapes to be smaller, but more importantly, more reliable. If you knew that the UNIVAC contained the code for calculating an angle, for example, and that piece of code had been tested before, you didn't have to check the programming tape for errors when it calculated angles because you knew it would delegate that job to the code inside the UNIVAC. Code that you already knew was reliable.

Grace called this invention a “compiler” because it compiled all the different functions from the library in one programme, in the same way a historian would compile books from a public library into an organized bibliography. She used this terminology to make it easier for people of that time to understand what her new invention was doing.

This invention changed everything because the “programming” process had now been reduced to mostly referencing commonly used code that already existed in the library, as opposed to writing it all out from scratch each time.

Combined with her common language invention, this meant that a mathematician could write out instructions in the common language, at which point all the operator had to do was identify where in the library each of the functions mentioned in the code was, then simply create a programme tape that called those library functions.

This effectively reduced the operator's role to one of looking up functions in the library, and so the phrase “programming the computer” grew to mostly mean writing the common language code in the first place.

Today

Since Grace invented this concept and made the first compiler in 1952, this principle has remained how programming is done to this day. The magnetic tape has been replaced entirely with microscopic circuitry that exists inside CD's, USB drives, computer / phone hard drives and internet cables. The operator who created the tape has also been replaced with parts inside a computer designed to read common language instruction and find the relevant pre-written code in an internal library. This operation part of the process is totally automated but the process of writing the common language in the first place has remained the same, as it still needs to be written by a human being.

Thanks to Grace's contributions, programmers no longer have to think about holes, or dots, or electronic “ones and zeros” as they are now known. All they need to do is learn how to write in the common language code and the computer will proceed to complile it, recognise what it needs to do, and do it.

Now It's Your Turn

Grace's place in computing history exists on a timeline that started with Jacquard's Loom and ends with the computers and small devices we have today. Many other people were part of this timeline that we didn't have time to mention, such as Charles Babbage and Alan Turing. But hopefully you now understand that all the hard work put in by these people throughout history means that YOU can get whatever you want out of your computer simply by typing in a language that is almost like English, but more technical.

They started the story, and now you can continue it by learning how to code yourself, and get your computer to do whatever you can imagine.

Click the button below to continue to the next section, where you will finally have a chance to do this for yourself.

Continue to 3: What Language?