Stardate 23018.1 or 21st of July 1969, mankind takes its first steps on the Moon. Mission commander Neil Armstrong and pilot Buzz Aldrin safely land the Lunar Module Eagle on the surface of the Moon.


Meet Margaret Hamilton, the woman who in 1965 lead the Software Engineering Division at MIT Instrumentation Laboratory. In the picture below, she is standing next to the printed source code of the flight software for the Apollo Guidance Computer. Over 400 people worked on Apollo’s software, which helped people safely land on the Moon.

You can bet your sweet ass they followed good software development practices. As a bare minimum, we know the software was tested, reviewed and approved. It was written in a special version of the assembly language. The code can be found on GitHub, so let's take a look.

Readability is important

All the source code for Luminary099 has 64.992 lines. There are 40.202 lines of code. There are no files without comments, 31.443 of the lines contain a comment and there are 5900 blank lines used.

The software was submitted by 1 person and approved by 6 other people.

Temporary does not exist in programming. It is a myth! Hope is not a strategy.

Respect your users, but don’t trust them.

Humour is essential for landing people on the Moon.

Errors will happen. Write software with that in mind.

“Due to an error in the checklist manual, the rendezvous radar switch was placed in the wrong position. This caused it to send erroneous signals to the computer. The result was that the computer was being asked to perform all of its normal functions for landing while receiving an extra load of spurious data which used up 15% of its time. The computer (or rather the software in it) was smart enough to recognize that it was being asked to perform more tasks than it should be performing. It then sent out an alarm, which meant to the astronaut, I’m overloaded with more tasks than I should be doing at this time and I’m going to keep only the more important tasks; i.e., the ones needed for landing…Actually, the computer was programmed to do more than recognize error conditions. A complete set of recovery programs was incorporated into the software. The software’s action, in this case, was to eliminate lower priority tasks and re-establish the more important ones … If the computer hadn’t recognized this problem and taken recovery action, I doubt if Apollo 11 would have been the successful moon landing it was.” — Margaret Hamilton, Director of Apollo Flight Computer Programming MIT Draper Laboratory, Cambridge, Massachusetts, “Computer Got Loaded”, Letter to Datamation, March 1, 1971.

Bonus: SLOCCount output for Luminary099

SLOCCount is a suite of programs for counting physical source lines of code (SLOC) in potentially large software systems. 

This is the output:

  • Total Physical Source Lines of Code (SLOC) = 40,202
  • Development Effort Estimate, Person-Years (Person-Months) = 9.67 (116.06) (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
  • Schedule Estimate, Years (Months) = 1.27 (15.22) (Basic COCOMO model, Months = 2.5 * (person-months**0.38))
  • Estimated Average Number of Developers (Effort/Schedule) = 7.62
  • Total Estimated Cost to Develop = $ 1,306,477 (average salary = $56,286/year, overhead = 2.40).


About the author

Cristian Messel is a full stack developer at Tecknoworks with 12 years of software development experience globally.

comments powered by Disqus

We don't just write code, we write stories.