RIP Margaret Hamilton, whose code saved the Apollo 11 Moon landing

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

Margaret Hamilton, who coined the term “software engineering” and led the development of onboard flight software for NASA’s Apollo program in the 1960s, died last week at the age of 90. A recipient of the Presidential Medal of Freedom in 2016, Hamilton was also immortalized as a LEGO minifig the following year—part of the “Women of NASA” set that also included astronauts Mae Jemison and Sally Ride.

玛格丽特·汉密尔顿(Margaret Hamilton)于上周去世,享年90岁。她曾创造了“软件工程”一词,并在20世纪60年代领导了美国国家航空航天局(NASA)阿波罗计划机载飞行软件的开发。汉密尔顿曾于2016年获得总统自由勋章,次年还被制成乐高小人仔,成为“NASA女性”系列套装的一部分,该套装中还包括宇航员梅·杰米森(Mae Jemison)和萨莉·莱德(Sally Ride)。

“To say Margaret Hamilton was a pioneer—to say she was ahead of her time—would be a dramatic understatement. She was a software engineer at a time when that field was in its infancy, and she not only developed advanced code herself but also led a team in using that nascent technology to develop one of the most complex systems humanity had ever achieved,” said Olivier de Weck, interim head of the MIT Department of Aeronautics and Astronautics. “The Apollo program still stands as one of our greatest testaments to the power of collaboration, ingenuity, and engineering, and Hamilton was a fundamental contributor to that program’s success.”

麻省理工学院航空航天系临时主任奥利维尔·德·韦克(Olivier de Weck)表示:“说玛格丽特·汉密尔顿是一位先驱,说她超越了时代,都远远不足以形容她。在软件工程领域尚处于萌芽阶段时,她就是一名软件工程师。她不仅亲自开发了先进的代码,还带领团队利用这种新兴技术,开发出了人类有史以来最复杂的系统之一。阿波罗计划至今仍是我们对协作、独创性和工程力量最伟大的见证之一,而汉密尔顿是该计划成功的关键贡献者。”

Born in 1936 in Paoli, Indiana, Hamilton graduated from Earlham College in 1958 with a degree in mathematics and a minor in philosophy—the latter a nod to her father (a poet) and grandfather (a headmaster). She married her first husband, James Cox Hamilton, that same year. The plan was for her to work until he finished his law degree, after which he would support her through graduate school to earn a PhD in mathematics.

汉密尔顿于1936年出生在印第安纳州的保利,1958年毕业于厄勒姆学院,主修数学,辅修哲学——后者是为了向她的父亲(一位诗人)和祖父(一位校长)致敬。同年,她与第一任丈夫詹姆斯·考克斯·汉密尔顿(James Cox Hamilton)结婚。当时的计划是她先工作,直到丈夫完成法律学位,之后由他支持她攻读数学博士学位。

She ended up working for Edward Lorenz, the MIT mathematician who set out to construct a mathematical model of the weather using a set of differential equations representing changes in temperature, pressure, wind velocity, and the like. You’ve probably heard the famous story of how Lorenz kept a continuous simulation running on his LGP-30 computer, and of that fateful 1961 day when he realized that even small differences in starting values could lead to very different outcomes—a sensitivity to initial conditions that is a hallmark of chaos theory, along with strange attractors.

她最终为麻省理工学院的数学家爱德华·洛伦兹(Edward Lorenz)工作,后者试图利用一组代表温度、气压、风速等变化的微分方程来构建天气数学模型。你可能听说过那个著名的故事:洛伦兹如何在LGP-30计算机上持续运行模拟,以及在1961年那个决定性的日子里,他意识到初始值的微小差异可能导致截然不同的结果——这种对初始条件的敏感性是混沌理论的标志,同时也涉及奇异吸引子。

You might not have known that it was Hamilton who was responsible for programming the LGP-30. Computers were still a novelty at the time, and neither Lorenz nor Hamilton had any programming knowledge; they taught themselves. Per a 2019 Quanta article, Lorenz was amused by her unusual methods: For instance, she once bypassed the “clunky debugging process” by rolling the paper tape down the hallway and editing the binary code by hand with a pencil. “I’d poke holes for ones, and I’d cover up with Scotch tape the others,” she recalled.

你可能不知道,负责LGP-30编程的人正是汉密尔顿。当时计算机还是新鲜事物,洛伦兹和汉密尔顿都没有编程知识,他们都是自学的。据《量子杂志》(Quanta)2019年的一篇文章记载,洛伦兹对她不同寻常的方法感到很有趣:例如,她曾通过将纸带铺在走廊上,并用铅笔手动编辑二进制代码,从而绕过了“笨拙的调试过程”。她回忆道:“我用笔戳孔代表‘1’,用透明胶带覆盖其他部分。”

In 1961, Hamilton moved to the SAGE project at MIT, writing software for a prototype XD-1 computer to aid the US Air Force in searching for possible enemy aircraft. Her first challenge: deciphering a program nobody had managed to get to work, perhaps because the author’s notes were written in Latin and Greek. Hamilton succeeded, noting with amusement that the program even printed out its answers in Greek and Latin. It was during this period that she became interested in the issue of software reliability.

1961年,汉密尔顿转入麻省理工学院的SAGE项目,为XD-1原型计算机编写软件,以协助美国空军搜寻可能的敌机。她面临的第一个挑战是破译一个没人能运行的程序,这可能是因为作者的笔记是用拉丁语和希腊语写的。汉密尔顿成功了,她打趣地指出,该程序甚至用希腊语和拉丁语打印出了答案。正是在这段时间里,她开始关注软件可靠性问题。

By 1965, Hamilton was all set to go to graduate school as planned when her husband spotted a newspaper ad saying that MIT’s Instrumentation Lab needed people to develop onboard guidance computer software for NASA’s Apollo program. She was the first programmer hired, and the first woman, working on six lunar landing missions from 1969 to 1972. At the time, binary code was stored using copper wires wound around cores. A “1” was a wire passing through a core, and a “0” was a wire bypassing the core. New England textile workers were hired to weave them together into long ropes, earning Hamilton the moniker “rope mother,” since she was responsible for those ropes.

到1965年,汉密尔顿本已准备好按计划去读研究生,但她的丈夫在报纸上看到一则广告,称麻省理工学院仪表实验室需要人员为NASA的阿波罗计划开发机载制导计算机软件。她是第一位被聘用的程序员,也是第一位女性,在1969年至1972年间参与了六次登月任务。当时,二进制代码是通过缠绕在磁芯上的铜线存储的。“1”是穿过磁芯的导线,“0”是绕过磁芯的导线。新英格兰地区的纺织工人被雇佣将它们编织成长绳,汉密尔顿因此获得了“绳子之母”的绰号,因为她负责这些绳子。

Hamilton would often bring her 4-year-old daughter, Lauren, to the lab on nights and weekends. The child loved pretending to be an astronaut in the simulators, and one day her random button-pressing caused the system to inexplicably crash. Apparently Lauren had typed “P01,” a pre-launch sequence, in the middle of the mission. Hamilton asked NASA if she could add a safeguard to prevent this from happening on an actual mission, but the higher-ups didn’t take it seriously. Then astronaut Jim Lovell actually made that error during the Apollo 8 manned mission to orbit the Moon, causing the navigational data to vanish. Hamilton was called in to retrieve the data, jokingly referring to this as the “Lauren bug.”

汉密尔顿经常在晚上和周末带着她4岁的女儿劳伦(Lauren)去实验室。孩子喜欢在模拟器里假装自己是宇航员,有一天她随意按下的按钮导致系统莫名其妙地崩溃了。显然,劳伦在任务进行到一半时输入了“P01”,这是一个发射前的程序。汉密尔顿询问NASA是否可以增加一个保护措施,以防止在实际任务中发生这种情况,但上级并没有当回事。后来,宇航员吉姆·洛威尔(Jim Lovell)在阿波罗8号载人绕月飞行任务中确实犯了这个错误,导致导航数据消失。汉密尔顿被叫去恢复数据,她开玩笑地称之为“劳伦漏洞”(Lauren bug)。

By 1968, Hamilton was assistant director in charge of the Command and Service Module team. Hamilton had the idea to incorporate a failsafe into the system software’s “priority display” interface routines, should the onboard guidance computer become overloaded with more tasks than it could handle in real time.

到1968年,汉密尔顿已担任负责指令舱和服务舱团队的助理主任。汉密尔顿提出了一个想法,即在系统软件的“优先级显示”接口程序中加入故障保护机制,以防机载制导计算机因任务过多而无法实时处理。