On 20th July 2021, we commemorated the 52nd anniversary of the first-ever moon landing of mankind. On a day like that in 1969, Neil Armstrong and Buzz Aldrin marked the first human steps on the lunar surface, making the Apollo 11 mission a huge success, surpassing a huge milestone in the history of space exploration. Even though we give the whole credit of the Apollo 11 mission to Armstrong, Aldrin, and Collins, there were innumerous persons behind the screens, taking huge responsibilities, and working around the clock to make this mission come true. Margaret Hamilton was one of those important persons, who was the leading coder, or more specifically, the error detector of the Apollo program. It wouldn’t be accurate to say “software engineer” because software engineering was not even a field or profession at that time; and wouldn’t be so even now without her contributions!
On the Road of a Blossoming Programmer
Margaret Elaine Heafield, born in 1936, has shown great passion for mathematics and hence earned a BA in mathematics with a minor in Philosophy in 1958, from Earlham College. She married James Hamilton in 1958 and had a daughter. They divorced in 1967, and in 1969, Margaret married again.
Despite Margaret’s initial ambition to pursue her studies on abstract mathematics, in 1959 she began working at the meteorology department at MIT, where she notably developed a program for predicting the weather. When transferred into the project SAGE (Semi-Automatic Ground Environment), the first US air defense system, in the MIT Lincoln Lab, she wrote a ground-breaking program to identify enemy aircraft. At that time, we had not yet established the disciplines of computer science or software engineering. Programmers only learned the job while doing the job hands-on.
They were looking for mathematicians to do software. When I first got into it, nobody knew what it was that we were doing. It was like the Wild West. There was no course in it. They didn’t teach it.Hamilton describes her first job role as a programmer here.
Margaret Hamilton’s Unforgettable “Forget It”
While working at the Lincoln Lab, she found out about the Apollo program at the MIT Instrumentation Lab in 1964. In Hamilton’s words, they were advertising for “people who could help them put a man on the moon with software,” at that time. Margaret, by that time, had written software that does their work on the ground, in the air, and among the clouds and she would have undoubtedly wanted to write a code that worked in space and ultimately on the moon too!
On her recruitment, the laboratory assigned her low-level programming tasks as a beginner. Her first code was a program to work in a mission abort in unmanned missions. Aborts were considered very unlikely to happen so that even Hamilton named her code as “Forget It”. However, that first code of hers was included in the next unmanned mission and the mission somehow went to abort, raising Hamilton’s piece of work into a position of high demand.
She was then promoted to man-rated software; that was used in a crewed space mission where a fault in the program could put an astronaut’s life in danger. Here, the code had not only to run correctly, but also had to detect hardware malfunctions and mistakes of users and make up for it. After all, the software was the only nearest companion of the astronauts and it had to be dependable. Hamilton’s remarkable instincts at error detection and prevention, undoubtedly guided by her philosophical thinking, made her a trustworthy programmer. “What if someone pushed the wrong key? What if an emergency occurs when everyone is busy?” She kept herself busy thinking over and over about all the possible what-ifs of a space mission and coding for all the alternatives.
Predictions of a “What If?” by Lauren
One time, when Hamilton brought her 4-year-old daughter Lauren to the lab, Lauren caused an unpredicted software crash by pushing a random key combination in the middle of a mission stimulation. Hamilton wanted to add a safeguard to the program right away, to prevent the same mistake from happening in a real mission, but the seniors thought it was too unlikely to happen as “astronauts were trained to be perfect” and dismissed Hamilton’s request. However, an astronaut made the exact mistake during the historic Apollo 8 mission, the first manned flight to orbit the moon. The mistake wiped all the navigation data from the system and Hamilton was called to bring the flight back to earth. While coming out from a major catastrophe, Hamilton once again showcased her expertise in error prevention and its critical usage in space flights.
The Apollo Guidance Computer (AGC) is effectively the “fourth astronaut” of the Apollo 11 mission. The design principles for the AGC were defined by the MIT Instrumentation laboratory which included priority scheduling, human-in-the-loop decision capability, and many more. At that time, the necessary programming techniques did not exist to realize the defined designs so everything has to be built from scratch, following the instincts of the developers.
The AGC consisted of 3 main parts; CORONA the command module (CM) program by Alex Kosmala; COLOSSUS the command module (CM) controller by Frederic Martin; and LUMINARY the lunar module (LM) software by George Cherry. The team worked under the direction of Margaret Hamilton, whose role was to exercise her specialty, error prevention, and it is not wrong to say that this specialty of hers prevented the Apollo 11 mission from going abort.
Margaret Hamilton’s Innovative Plan for the “Would Never Happen” Scenario
It was 20th of July 1969 and Neil Armstrong was only 8 minutes away from marking the first human step on the lunar surface; they were only 6,000 feet above the surface, which was a very, very near distance to it. All the behind-the-screen crew was wide awake, listening to the mission, a million thoughts running in their minds. They might have been tasting “sheer terror” as Hamilton recalled later. At that critical moment of landing, several error alarms triggered in the Apollo computer. Alarm 1201 and alarm 1202 indicated error displays that were considered as “never supposed to display”. Luckily, Hamilton had had way more experiences with constants gone wrong and she had prepared everything beforehand to save the situation.
The alarms were triggered by the overloading of the computer processor, which was actually a hardware bug. We must remember again that the computers that took men to space were not the high-end, sophisticated computers that we work on today. They were always at the risk of shutting down and losing memory at the slightest mistake or just one additional command, and the risk was 100 times bigger when it happened in space. It was only good software, that could save a mission with such computers. Hamilton had designed the program to swiftly restart and focus on high-priority tasks, using innovational priority scheduling design. Thus, the AGC automatically recovered at that critical point, deleting its lower-priority tasks; and when the “GO” command was given, the landing became a success. Hence, it is not wrong to say that it was Hamilton’s code that enabled Apollo 11 to land on the moon.
Landing Mankind and Software, on the Moon
A complete set of recovery programs was incorporated into the software. The software’s action, in this case, was to eliminate lower priority tasks and re-establish the more important ones. The computer, rather than almost forcing an abort, prevented an abort.Margaret Hamilton recalling the events on the moon landing.
As Hamilton likes to say, the Apollo 11 eagle’s crew were the first humans to walk on the moon, and her team’s code was the first software to run on the moon.
Margaret Hamilton’s exceptional contribution towards programming and software did not end there. She pioneered in bringing together the words “software” and “engineering” together to create the new term of “software engineering” to address what she had been doing all along. She discovered many software design principles and engineering techniques while coding to ensure the wellbeing of humans in unknown space. In 2016, she received the Presidential Medal of Freedom for her role in creating the flight software. Margaret Hamilton undoubtedly makes up for one strong woman on earth who brought outer space nearer to us.
01. Cameron, L. (2020, August 11). First Software Engineer. IEEE Computer Society. https://www.computer.org/publications/tech-news/events/what-to-know-about-the-scientist-who-invented-the-term-software-engineering
02. CBS Boston. (2019, June 28). Margaret Hamilton: MIT Software Pioneer Who Helped Save Apollo 11 Moon Mission. https://boston.cbslocal.com/2019/06/28/margaret-hamilton-apollo-11-software-pioneer-interview/
03. Fabio, A. (2018, April 11). Margaret Hamilton Takes Software Engineering To The Moon And Beyond. Hackaday. https://hackaday.com/2018/04/10/margaret-hamilton-takes-software-engineering-to-the-moon-and-beyond/
04. Gregersen, E. (2021, August 13). Margaret Hamilton | Biography & Facts. Encyclopedia Britannica. https://www.britannica.com/biography/Margaret-Hamilton-American-computer-scientist
05. McMillan, R. (2015, October 13). Her Code Got Humans on the Moon—And Invented Software Itself. Wired. https://www.wired.com/2015/10/margaret-hamilton-nasa-apollo/
01. Featured Image: Designed by Dasith Tilakaratna (SEDS UOC). Image resourced from: https://bit.ly/2ZOXq8B
02. Image 01: https://cnn.it/2Yatl2y
03. Image 02: https://bit.ly/3a4rkYs
04. Image 03: https://bit.ly/3uK8rU7