The Woman Who Invented the Rulebook for Writing Software That Cannot Fail

NASA needed software that could not fail - so she invented the discipline now called software engineering

分享
The Woman Who Invented the Rulebook for Writing Software That Cannot Fail
generate by gemini

IT HISTORY

The Woman Who Invented the Rulebook for Writing Software That Cannot Fail

NASA needed software that could not fail — so she invented the discipline now called software engineering

In 1965, Margaret Hamilton was 28 years old, had a mathematics degree, and had just been handed an impossible job.

NASA needed software to fly humans to the Moon and bring them back alive. Not software that was mostly correct. Not software that was usually reliable. Software that could not, under any circumstance, fail.

There was no textbook for this. No discipline. No prior art. The phrase “software engineering” did not exist yet. Hamilton would coin it herself.

She was NASA’s first programmer on the Apollo project. She would become the reason it succeeded.

Margaret Hamilton standing beside the stacked Apollo navigation software printouts, MIT, 1969
Hamilton in 1969, beside the navigation software her MIT team built for Apollo. The printouts are the actual source code. Years later, LEGO recreated this photo for its Women of NASA set. / wikipedia

The Alarm Nobody Else Had Planned For

On July 20, 1969, Apollo 11 began its descent to the lunar surface.

Six hundred million people were watching the live broadcast. Inside NASA Mission Control in Houston, no one was breathing easily.

Then the spacecraft’s computer started flashing: 1202. Program alarm.

NASA Mission Control room during the Apollo 11 Moon landing, engineers watching the descent https://images-assets.nasa.gov/image/S69-39817/S69-39817~large.jpg
The guidance computer had 2K of memory. A switch left in the wrong position was flooding it with extra data — the computer was overloaded and throwing alarms. / nasa.gov

The call had to be made in seconds: keep descending, or abort.

The team trusted the software. They told Apollo 11 to keep going.

That trust was earned. Hamilton’s software had been designed with a specific principle: when resources run out, do not crash. Prioritize. Drop the low-importance tasks. Protect the ones that matter most.

The computer shed the extra load and guided Neil Armstrong and Buzz Aldrin to a safe landing.

Post-flight analysis confirmed the cause: the switch error, the overload, and the recovery. Hamilton’s system had anticipated a class of failure nobody had written down as a requirement. It handled it anyway.

A Mathematician in a Field That Didn’t Exist

Margaret Hamilton was born in 1936 in Indiana. She studied mathematics at the University of Michigan and graduated in 1958, then took a job at MIT writing weather-prediction software.

She was good at it — unusually good. On her first project, she was handed a program nobody else could decode. The original author had written the comments in Greek and Latin. Hamilton was the first person to get it running.

In 1961, she joined SAGE, the U.S. Air Force’s first air-defense radar system. Her talent for untangling impossibly complex code became well known.

Then, in 1965, her husband spotted a notice in the local paper. NASA was looking for programmers.

Hamilton read it and thought, "I have to do this."

She joined the Apollo project and became its first programmer. Within a few years, she was leading the team responsible for the onboard flight software — the code that would have to work perfectly, the first time, with no safety net, on the surface of the Moon.

Writing Code That Cannot Fail

The central challenge was the hardware.

Apollo needed a computer small enough to fit inside a spacecraft, which meant it had to fit within one cubic foot. The computers of that era filled entire rooms. Miniaturizing one was, by itself, an extraordinary feat of engineering.

The Apollo Guidance Computer, a compact metal box roughly one cubic foot in size
AGC Computer (NASM Collection Physical Photo) / Wikimedia

The result, called the AGC (Apollo Guidance Computer), had 2K of RAM and 36K of ROM. The ROM was a technology called core rope memory — ones and zeros physically woven into wire and magnetic cores. A wire threaded through a core meant 1. A wire routed around it meant 0.

Core rope memory: copper wires woven through a grid of tiny magnetic ferrite cores, the physical storage medium for Apollo's flight software /https://commons.wikimedia.org/wiki/Special:FilePath/Agc_rope.jpg
Core rope memory /wikipedia

Today, saving code takes one keystroke. Saving the Apollo flight software required textile workers in New England mills to weave wire by hand through hundreds of magnetic cores, one by one, without a single error. Hamilton’s team informally called it LOL memory — Little Old Lady memory.

There was no way to patch a bug after launch. The software had to be correct before the wire was woven.

Hamilton established the practices her team would follow: exhaustive unit testing, system-level simulation, and formal error analysis. She wasn’t borrowing these practices from an existing field. She was inventing them.

The Mistake Her Daughter Made First

Hamilton often brought her daughter, Lauren, to the office on weekends. Lauren was curious about the simulators — the mock cockpits where astronauts rehearsed their missions.

One afternoon, Lauren sat down and started pressing buttons. She selected a function called P01 — a pre-launch initialization routine. The simulator crashed completely.

Hamilton realized immediately: an astronaut could do exactly the same thing in flight. She wanted to add a software guard to prevent it.

NASA’s response was firm: the astronauts are professionals. They are trained. They would never select P01 mid-mission.

Changing the core rope memory was genuinely difficult and expensive. NASA decided the risk wasn’t worth it.

Then, during the Apollo 8 mission orbiting the Moon, an astronaut selected P01.

The spacecraft lost its navigational reference entirely. It no longer knew where it was. It could not have brought the crew home.

Hamilton and her team worked through the night — nine hours straight — and restored Apollo 8’s trajectory.

After that, the software shipped with built-in protections against exactly this class of failure.

The experience shifted how Hamilton thought about the whole problem. She began to see the Apollo mission as a system with three components: hardware, software, and people. A system fails when any of those components fail — including when people do something the designers didn’t anticipate. The software’s job was to handle that, too.

Naming the Thing She Was Doing

For most of the Apollo program, what Hamilton’s team did had no official name.

The scientists and engineers around her treated software as secondary — something that programmers wrote to make the real hardware work. It wasn’t considered engineering. It wasn’t considered serious.

Hamilton disagreed. She had seen what it took to write software that could not fail: rigorous process, mathematical precision, systematic testing, deep attention to error conditions. This was engineering. It deserved the same respect as any other branch of engineering.

She started calling it software engineering.

At first, people laughed. The phrase was a joke — an overreach. Software development, engineering? Please.

Over time, NASA stopped laughing. The discipline Hamilton was building would become one of the agency’s most important tools. The rigor she insisted on — the documentation, the simulation, the formal verification — was the reason Apollo 11 landed and returned.

The term she coined is now used by every technology company on earth.

What She Left Behind

On November 22, 2016, President Obama awarded Margaret Hamilton the Presidential Medal of Freedom, the highest civilian honor in the United States, for her contributions to Apollo’s flight software and to the field of software engineering.

Margaret Hamilton receiving the Presidential Medal of Freedom from President Obama, 2016 https://obamawhitehouse.archives.gov/sites/obamawhitehouse.archives.gov/files/images/Blog/PBMF16_0002.jpg
Margaret Hamilton receiving the Presidential Medal of Freedom from President Obama, 2016 / obamawhitehouse.archives.gov

In her own words:

Looking back, we were the luckiest people in the world. We had no choice but to be pioneers.

And:

When I want to understand something new, or build something new, I never let fear become an obstacle.

Hamilton didn’t inherit a playbook. She wrote one from scratch, under conditions where the cost of a mistake was measured in human lives.

The rulebook she invented — test everything, simulate failure, plan for the error nobody told you about, treat software as a discipline worthy of the word engineering — is the same rulebook the industry still uses today.

She had to invent the field before she could work in it.

Then she used it to put humanity on the Moon.


Support writers. All our non-profit’s offerings here.

Click here to subscribe to the IT Chronicles newsletter.
Click for Wordsmith, Mystery Writing, Write Like Stephen King, more

By the EIC Susan Brearley with Ideogram