Margaret Hamilton joined MIT to work on software projects (including meteorological software for Edward Lorenz, father of chaos theory, and SAGE system software that searched for enemy airplanes) before landing on the MIT/NASA contract as the lead programmer on the Apollo Guidance Computer. She worked on every manned Apollo mission as well as many unmanned missions. For the manned missions, Hamilton led the team that developed the on-board flight software for the command and lunar modules. She was the Director of the Software Engineering Division at MIT's Instrumentation Laboratory.
The code Hamilton developed was the software that the two Apollo spacecraft computers would use and would be the base of what today is an industry of software engineers who owe their careers to Hamilton and her team. The on-board flight software was built to be asynchronous. Every job in the software was assigned a unique priority by members of the team. Hamilton developed software to detect system errors and recover from them in real time. This included her man-in-the-loop priority-display-interface-routines that gave the software the ability to communicate asynchronously in realtime with the astronauts─the software and astronauts running in parallel─within a distributed system-of-systems environment. With this as a backdrop, the priority displays warned the astronauts in case of an emergency by interrupting the astronauts' normal mission displays and replacing them with priority alarm displays, providing them with emergency related options from which to select. Such was the case on Apollo 11 just before landing on the moon when the computer, as a result of the rendezvous radar switch having been left in the wrong position, became overloaded. The priority alarm displays were a reminder to the astronauts to put the radar swich back where it belonged. When the priority displays gave them the choice: "to land" or "not to land", because of their (and mission control's) belief in the integrity of the on-board flight software, they chose to land.
Hamilton often brought her daughter, Lauren, to work during off-hours. One time while some of the team were running mission scenarios on the hybrid simulation computer, Lauren went exploring and began selecting the DSKY keys in an "off nominal" manner. She started up a mission scenario, and caused the mission to fail by selecting P01 (pre-launch) during midcourse. Hamilton asked, "what if P01 were inadvertently selected by a real astronaut during midcourse in a real mission?" This would be a major problem, because it would wipe out the navigation data. Not allowed to add code to prevent the astronaut from making this mistake, Hamilton added a program note to the software, "do not select P01 during flight". In the next mission, Apollo 8, the astronaut made the same mistake; Hamilton and her team were able to help the astronauts re-upload the navigational data to replace the destroyed data. She now had approval to add software to prevent this problem from happening on future Apollo missions.
"Hamilton is the person who came up with the idea of naming the discipline, software engineering, as a way of giving it legitimacy". She led an empirical study of Apollo and later efforts, resulting in her systems theory of control. From its axioms, the universal systems language was derived together with its automation and preventative paradigm. Hamilton is CEO of Hamilton Technologies Inc. She received the NASA Exceptional Space Act Award (2003) and the Presidential Medal of Freedom from President Barack Obama (2016). She received her own Lego in the Women of NASA Lego set.