(CBS) - Imagine the moment as Neil Armstrong and Buzz Aldrin were descending toward the moon, a few minutes away from landing in the Sea of Tranquility. Civilization's most historic event was within eyesight when a program alarm was set off by the Apollo Guidance Computer.
The unforeseen alarm was something neither Armstrong nor Aldrin came across in their training simulations. Almost every other alarm code they had encountered would lead to an abort. After travelling over 950,000 miles, would they be forced cut short their momentous mission nearly a decade in the making?
Fortunately, for Apollo 11 and all of mankind, a young, brilliant MIT software engineer saw this coming from nearly a million miles away.
"Just before landing on the moon was the most exciting part, for some of us at least," Margaret Hamilton, lead developer for the Apollo on-board flight software, said in a recent interview with CBS Local. "Things were going perfectly in our minds. They were almost there right. And all of a sudden the priority alarms came on. 1201 and 1202 and right away I knew that those alarms came on when there was an emergency and they had no business going on right then."
The relatively primitive computer was being overloaded by tasks from both the radar and landing programs. It was Hamilton's code that helped detect the conflict, prioritize the computing power available, and keep the mission on track. The rest is history.
"I like to say not only was that the first human on the moon, but the first software to run on the moon," said the unsung hero. It was one of many benchmark moments for Hamilton, who helped pioneer the yet-to-be-named field of software engineering during the days of the Apollo program.
Born in Indiana in 1936, Hamilton studied at the University of Michigan before earning a degree in mathematics with a minor in philosophy from Earlham College. She taught high school math before following her husband to Cambridge, Massachusetts as he pursued a degree at Harvard University. She found her own work at MIT.
"They were looking for mathematicians to do software," said Hamilton. "I was hired by Professor Lorenz."
Edward Lorenz is best known as the founder of chaos theory and the butterfly effect, stating the smallest of causes can have momentous effects. His introduction of computer programming to Hamilton would have a ripple effect that would eventually lead to mankind's giant leap.
"I ended up doing software programming which I had never done before, because nobody was doing it at the time. That's the first job in my field-- which was not yet a field."
From her start at MIT she set out on a track of anticipating problems and solving them.
"I got started on the road of worrying, about error detection," said Hamilton.
She moved to MIT's Lincoln Lab, working on the SAGE Computer System, an air-defense network employed by the US military to coordinate radar stations and direct airplanes to intercept potential Soviet bombers.
"I then found out about the Apollo program at Draper, at the MIT Instrumentation Lab, it was called at the time, and they were advertising for people who could help them put man on the moon with software."
"This looked like something that was unreal and I wanted to be a part of it."
As a junior programmer, Hamilton was initially given low-end programming tasks, the least important software needed for the missions, but she instantly showed her aptitude for error detection.
"The first assignment they gave me for the unmanned missions was to write a program for the computer that it would go to if there was an abort," said Hamilton.
Aborts were considered so unlikely that those tasks were given to the least experienced programmers.
"I wrote the program and called it 'Forget It' because 'forget it' if it aborts."
When the next unmanned mission came along, her code was added to the software and, of course, the mission indeed went to abort.
"It went to my program called "Forget It" and I was the only one who knew what was going on in the software," she recalled.
Hamilton quickly worked her way through the ranks, soon becoming the lead developer for the on-board flight software for the Apollo Guidance Computer. Her commitment to error detection and prevention became legendary.
"You had to be able to discover a system error in real time when you were flying on a mission. It had to be reliable. It had to not only work, but it had to work the first time. If somebody made a mistake like an astronaut when he's keying in something and it keys in the wrong thing, then you got to save him from that, right?"
Hamilton wasn't simply a pioneer for her brilliance in programming, but as a working mother in the 1960s, leading the charge in a male-dominated environment.
"I was the only woman in the beginning in the field," she said. "I was oblivious to the difference between men and women. At MIT, they cared more about that you knew what you were doing and could help them solve their problem because they had a deadline."
"You just worked very late at night. You worked all weekends, and if you had a child like I did, you brought her in at nights and weekends so you could have your personal life."
Hamilton's parenting at work turned serendipitous when, one day, her daughter was playing astronaut, hitting different buttons on the computer panel in her mother's office.
"She had started up a mission. I saw that her simulation had crashed. What happened was she had selected the pre-launch program when it had already taken off and was in flight and that's when everything crashed," Hamilton remembered.
"I told the people about it and I said, 'you know, the astronaut could do the same thing.' But everyone said, 'No, no, don't worry about it. You're too much of a worrier.'"
NASA management found it incredulous that an astronaut who had been thoroughly trained could make such a mistake. It would never happen, and they would not allow Hamilton to add her preventative code.
Then, during Apollo 8's first manned orbit of the moon, experienced astronaut Jim Lovell made that exact mistake. The mistake wiped out navigational data that was necessary for the Apollo navigation system to guide the astronauts back home. Fortunately, because of Hamilton's notes, they were able to diagnose the problem, and nine hours later replace the missing data. While a major catastrophe was avoided, everyone again realized Hamilton's penchant for predicting problems.
"After that mission was over, everybody's joking, saying 'seriously, you can put that [code] in now.'"
In 2016, for her extraordinary contributions to NASA, and the Apollo 11 mission in particular, Hamilton received the Presidential Medal of Freedom, the highest honor given to a civilian.
"Three minutes before Armstrong and Aldrin touched down on the moon, Apollo 11's lunar lander alarm triggered, red and yellow lights across the board," said President Barack Obama during the ceremony. "Our astronauts didn't have much time, but, thankfully, they had Margaret Hamilton.
"Luckily for us, Margaret never stopped pioneering, and she symbolizes the generation of unsung women who helped send humankind into space. Her software architecture echoes in countless technologies today, and her example speaks of the American spirit of discovery that exists in every little girl and little boy who know that, somehow, to look beyond the heavens is to look deep within ourselves -- and to figure out just what is possible."
Being prepared for whatever is possible is what Margaret Hamilton does best.
"I can always think of problems. It's in my DNA."
for more features.