Skill Builder: Write Your Code Like NASA Does

Maker News
Skill Builder: Write Your Code Like NASA Does
YouTube player

As a software engineer, I’m always looking for new ways to improve the quality of my code. When I stumbled upon a set of rules for writing safety critical code, published by NASAs Jet Propulsion Laboratory (, I was more than intrigued! The idea of writing software so robust that it can be trusted to launch rockets and orbit satellites was definitely exciting, so I tried to figure out how I could apply these rules to my own code. While these rules were originally mean for code written in C, I’ve found that we can repurpose some of them into general guidelines for whatever language our own projects are written in, like Python for the Raspberry Pi! 

The most applicable “guidelines” I found from NASAs rules are as follows:

1. Keep It simple: Be intentional with what you write, and keep things concise. More practically, this could mean keeping your functions very small and targeted. Rather than having a single function that does many things, split each task into its own function for better modularity.

2.Write unit tests: While unit tests are often a pain to write, they can definitely save you in the long run as they have the ability to tell you exactly when, where, and (hopefully) why something has failed.

3. Pay attention to warnings, leave all warnings on: I’m someone who tends to selectively ignore the warnings my compiler is giving me, but learning how to read and interpret the warnings you’re receiving can make all the difference in writing clean, robust code.

My own goal is to try to apply these rules as often as possible, and (maybe) I’ll one day get to send something to space!

Discuss this article with the rest of the community on our Discord server!
Allyson Aberg

Interested in everything software and robots!

View more articles by Allyson Aberg


Ready to dive into the realm of hands-on innovation? This collection serves as your passport to an exhilarating journey of cutting-edge tinkering and technological marvels, encompassing 15 indispensable books tailored for budding creators.