Margaret Hamilton — Coding to the Moon
On July 20 of 1969, just as the Apollo 11 astronauts were about to land on the moon, something unexpected happened that stopped the heartbeats of the entire crew at Mission Control in Houston. The mission could have been aborted but thanks to Margaret Hamilton and her code to prevent user-errors, the landing was safe and three minutes later a human placed their feet on the moon for the first time in history.
Hamilton spent long hours at MIT’s Apollo project from NASA, leading the Software Engineering Division responsible for the unmanned missions on-board flight software. Often on nights and weekends, she took her daughter Lauren to work and she would see Margaret use the simulator’s display-and-keyboard unit (DSKY) to test the software. One day, wanting to play astronaut, Lauren crashed the simulator and Margaret realized it was because she had selected the pre-launch program PO1 during “flight”. She instantly started to worry about the debug session her daughter had adventured and asked herself “What if the astronaut did what she just did?”.
Hamilton started telling to the people at MIT that maybe they should think of putting some change in the code if the astronauts accidentally choose PO1, but they told her that astronauts were well-trained never to make a mistake so they wouldn’t need that. “Everyone said, ‘That would never happen’”, she remembers. But this same thing happened with the preceeding flight Apollo 8, so management at NASA at last agreed to include a user-error check in the code for all future flights. Margaret even added a program note that said “Do not select PO1 during flight”.
Expect the Unexpected
That day the normal mission sequences were interrupted by priority displays of 1201 and 1202 alarms warning there was an emergency of “executive overflow”, giving the astronauts a go/no go decision (to land or not to land). What happened was that the Rendezvous Radar system switch had been manually set to the wrong position and because the computer did not have enough time to do the request it started overflowing and triggered the alarms.
“It quickly became clear that the software was not only informing everyone that there was a hardware-related problem, but that the software was compensating for it.”
Thanks to Hamilton’s ultra-reliable code, the Lunar Module’s computing system was simply dumping the low priority jobs and carrying on with the important ones. The code prevented to abort the mission, a go decision to land was sent from Earth and minutes later Neil Armstrong voiced: “Houston, Tranquillity Base here. The Eagle has landed”.
The assembly code for the Command Module’s (CM) Apollo Guidance Computer (AGC) that Margaret Hamilton and her team wrote is public and open. Up to present day, no bug has ever been found on any onboard flight software Apollo mission for Hamilton was extremely detailed; as she said, “There was no second chance”.
Humans today are expected to be fully integrated to the software systems, but that wasn’t always the case. Hamilton definitely built the blocks for modern software engineering, a term she coined, while moving from “complete freedom to bureaucratic overkill”.
For instance, with roots on Apollo missions Margaret’s categorization of interference errors led to a system of control that set the foundations of the Universal Systems Language (USL) and Development Before the Fact (DBTF) paradigm. Traditionally, software design approach is more about fixing, testing for errors once it is already running, but Hamilton USL’s development-before-the-fact philosophy seeked to be preventive, virtually eliminating errors before they arrise.
“We learnt that systems are asynchronous, distributed and event driven in nature. This should be reflected in the language to define them and the tools to build them, characterizing natural behaviour in terms of real-time execution semantics.”
Margaret has received many awards in recognition for her legacy, such as the Augusta Ada Lovelace Award and the Presidential Medal of Freedom, the highest civilian honour in the United States. However, arguably the coolest recognition she had was getting a LEGO figure on the Women of NASA set, characterized like the famous photo in which she stood next to her pile of code.
Advent Calendar — Help us make it a book!
From December 1st until December 24th we plan to release one article each day, highlighting the life of one of the many women that have made today’s computing industry as amazing as it is: From early compilers to computer games, from chip design to distributed systems, we will revisit the lives of these pioneers.
Each article will come with an amazing illustration by @SebastianNavasF.
If you want to see these series to become a book with expanded articles and even more illustrations by Sebastián, then subscribe to our newsletter below.
- Illustration: Sebastián Navas
- Annual Report of the NASA Inventions & Contributions Board — 2003 (http://www.htius.com/News_Links/251093main_The_NASA_Heritage_Of_Creativity.pdf)
- International Conference on Software Engineering celebrating its 40th anniversary and 50 years of Software engineering. Plenary Session Margaret Hamilton — 2018 (https://www.youtube.com/watch?v=ZbVOF0Uk5lU)
- Tales from the lunar module guidance computer — Don Eyles (https://www.doneyles.com/LM/Tales.html)
- Recalling the ‘Giant Leap’ — Massachusetts Institute of Technology News (http://news.mit.edu/2009/apollo-vign-0717)
- Virtual Apollo Guidance Computer Project (http://www.ibiblio.org/apollo/index.html)
- Wikipedia https://en.wikipedia.org/wiki/Margaret_Hamilton_(scientist)