Categories
Moon Landing Software Space Exploration Technology

Margaret Hamilton, the first software engineer [her code got humans on the moon!]

Margaret Hamilton is not only one of the first software developers, but she also literally created the term “Software Engineering” to describe her work. The code she wrote successfully put humans on the moon for the first time.

“Margaret Hamilton, NASA’s First Software Engineer”. When it comes to Margaret Hamilton’s career, she literally shoots for the moon. Hamilton discusses joining NASA as their first software engineer and creating the software that launched the Apollo 11, first crewed mission to the Moon.

The first software engineer: Margaret Hamilton

Margaret Hamilton was born on August 17, 1936, in Paoli, Indiana, United States. In school, she loved Mathematics most as “she liked deriving the answers because she didn’t want to memorize”.

She studied mathematics at the University of Michigan and in 1958 she received her undergraduate degree. She married shortly thereafter.

Her husband was pursuing a law degree at Harvard. In order to support him, she put her graduate school on hold and briefly taught high school mathematics and French. Then she got a job as a programmer at MIT (Massachusetts Institute of Technology) to develop software for predicting the weather and detecting the enemy planes.

It was this work that made her a candidate for a job opening from NASA that her husband spotted in a newspaper.

“We are looking for people to do programming to send men to the moon”

Hamilton recalls: “They (NASA) announced that they were looking for people to do programming to send men to the moon”.

By 1965, at the age of 28, Hamilton joined the Charles Stark Draper Laboratory at MIT, which at the time was working on the Apollo space mission. She was the first programmer NASA hired.

But, eventually, she would lead the team developing the onboard flight software, which included algorithms designed by various senior scientists for the Apollo command module, lunar lander, and the subsequent Skylab (the only space station the U.S. has operated exclusively).

Margaret Hamilton standing next to Apollo 11 Code
Margaret Hamilton in 1969, when she was the lead software engineer of the Apollo Project. She is standing next to a huge stack of code she and her MIT team produced for the Apollo project. This is perhaps her most famous photo. Image source: Intel

It was like the “Wild West”

It was ten years before Microsoft. The field of computing was still very new. Computers were huge, often taking up entire rooms, if not an entire warehouse, and the work of programming was still developing.

Hamilton says “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.”

According to Wired, Apollo mission didn’t even mention the word software, MIT aeronautics professor David Mindell writes in his book Digital Apollo. “Software was not included in the schedule, and it was not included in the budget.”

But, the importance of software would become clear as the Apollo project progressed.

Hamilton’s was not an easy job. The responsibility was too great. Sometimes the pressure kept here up at night. Once, after a late-night party, she rushed back to the computer lab to correct a piece of code she’d suddenly realized was flawed. “I was always imagining headlines in the newspapers, and they would point back to how it happened, and it would point back to me.”

Astronauts never make mistakes – they were trained to be “perfect”

Margaret Hamilton says: “Mostly men were working there. They had somebody at home to take care of their kids. I had no choice.”

So she brings her daughter Lauren into work. She’d see her mother playing astronaut to test the software and doing the kinds of things the astronauts would do.

Hamilton’s daughter wanted to do it too: playing astronaut – and she did.

Then, one day, all of a sudden, everything came crashing on the simulator. After investigating what could be the cause, Hamilton realized that her daughter selected the pre-launch program called P01 during flight.

Hamilton recalls: “I said, oh my god, this is not good. We really need to put protection in there, because the astronaut really could do what she did by mistake.”

But NASA said “no”. They said, “astronauts never make mistakes – they trained to be ‘perfect'”.

But, as everybody knows, “whatever can go wrong, will go wrong”. Right around Christmas 1968, five days into the historic Apollo 8 flight (it was the first crewed spacecraft to leave low Earth orbit, reach the Moon, orbit it, and safely return), astronaut Jim Lovell inadvertently selected P01 during flight.

Luckily, Hamilton won the debate eventually. She programmed error-checking codes that allowed the Apollo 8 flight to successfully return to Earth, even when astronaut Jim Lovell aboard inadvertently deleted all the navigation data the onboard computer had been collecting (see notes 1).

Margaret Hamilton testing the Apollo software
Margaret Hamilton testing the software during her time as lead Apollo flight software designer. Image: Wikipedia

The code of Margaret Hamilton eventually got humans to the moon

On July 16, 1969, NASA launched Apollo 11, the first crewed mission to the moon. Three minutes before landing, a crewmember set a switch in the wrong position, sending software into overload with interrupts caused by incorrectly phased power supplied to the lander’s rendezvous radar.

The program alarms indicated “executive overflows”, meaning the guidance computer could not complete all of its tasks in real time and had to postpone some of them.

Margaret Hamilton recalls: “There was an emergency. – giving the astronauts a go/no go decision (to land or not to land)”.

Jack Garman, a NASA computer engineer in mission control, recognized the meaning of the errors that were presented to the astronauts by the priority displays and shouted, “Go, go!”

On Sunday, July 20, at 20:17:40 UTC, the Lunar Module named “Eagle” landed on the moon.

Neil Armstrong announced the landing with the words: “Houston, Tranquility Base here. The Eagle has landed.”

Moon Landing - Buzz Aldrin on the Moon
Margaret Hamilton’s code got humans on the moon – Moon Landing: Astronaut Buzz Aldrin, lunar module pilot, stands on the surface of the moon near the leg of the lunar module, Eagle, during the Apollo 11 moonwalk. Astronaut Neil Armstrong, mission commander, took this photograph with a 70mm lunar surface camera. While Armstrong and Aldrin descended in the lunar module to explore the Sea of Tranquility, astronaut Michael Collins, command module pilot, remained in lunar orbit with the Command and Service Module, Columbia. This is the actual photograph as exposed on the moon by Armstrong. He held the camera slightly rotated so that the camera frame did not include the top of Aldrin’s portable life support system (“backpack”). A communications antenna mounted on top of the backpack is also cut off in this picture. When the image was released to the public, it was rotated clockwise to restore the astronaut to vertical for a more harmonious composition, and a black area was added above his head to recreate the missing black lunar “sky”. The edited version is the one most commonly reproduced and known to the public, but the original version, above, is the authentic exposure. This image was cataloged by NASA Headquarters of the United States National Aeronautics and Space Administration (NASA) under Photo ID: AS11-40-5903. Image: Wikipedia

Margaret Hamilton invented the term “Software Engineering”

In a recent interview with the Spanish newspaper El País, Margaret Hamilton explains why she chose the term “software engineering ” to call her job:

“During the first days of Apollo Project, the software was treated as an adopted child and was not taken seriously as other engineering disciplines, such as hardware engineering, and was thought of as art and magic, not science. Knowing this, I fought to bring the software legitimacy so that it -and those building it- would be given its due respect, and thus I began to use the term ‘software engineering’ to distinguish it from hardware and other kinds of engineering, yet treat each type of engineering as part of the overall systems engineering process.”

When I first started using this phrase, it was considered to be quite amusing. It was an ongoing joke for a long time. They liked to kid me about my radical ideas. Software eventually and necessarily gained the same respect as any other discipline.”

NASA soon realized that Hamilton’s “software engineering” would be the tool they needed to beat the Soviet Union in the race to the Moon.

The Presidential Medal of Freedom

Margaret Hamilton receives the Presidential Medal of Freedom
Margaret Hamilton receives the highest civilian honor in the United States: The Presidential Medal of Freedom

In 2016, Margaret Hamilton received the highest civilian honor in the United States: The Presidential Medal of Freedom, for her work on the Apollo program and the creation of the Universal Systems Language (USL, a modeling language and formal method for the specification and design of software and other complex systems).

Notes

1. Apollo 8 guidance computer incident

According to Wired and many other websites, she just added a note saying “Do not select P01 during flight”. Then, during the Apollo 8 flight, astronaut Jim Lovell inadvertently selected P01. After spending nine hours, Hamilton and the MIT coders came up with a fix, they uploaded new navigational data, and the mission (and the lives of the astronauts aboard) was saved.

But I couldn’t verify that story. Wikipedia’s Apollo 8 entry, which cites Richard W. Orloff, for example, tells a different story:

Lovell accidentally erased some of the computer’s memory, which caused the inertial measurement unit (IMU) to contain data indicating that the module was in the same relative orientation it had been in before lift-off; the IMU then fired the thrusters to “correct” the module’s attitude.

Once the crew realized why the computer had changed the module’s attitude, they realized that they would have to reenter data to tell the computer the module’s actual orientation. It took Lovell ten minutes to figure out the right numbers, using the thrusters to get the stars Rigel and Sirius aligned, and another 15 minutes to enter the corrected data into the computer. Sixteen months later, during the Apollo 13 mission, Lovell would have to perform a similar manual realignment under more critical conditions after the module’s IMU had to be turned off to conserve energy.

Orloff is the author of books titled “Apollo By The Numbers” and “Apollo: The Definitive Sourcebook”.

Sources

M. Özgür Nevres
Özgür Nevres

By M. Özgür Nevres

I am a software developer and a science enthusiast. I was graduated from the Istanbul Technical University (ITU), Computer Engineering. In the past, I worked at the Istanbul Technical University Science Center as a science instructor. I write about the planet Earth and science on this website, ourplnt.com. I am also an animal lover! I take care of stray cats & dogs. This website's all income goes directly to our furry friends. Please consider supporting me on Patreon, so I can help more animals!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.