Makezine - Skill Builder: Write Your Code Like NASA Does

Et ouais ... écrire un truc qui s'en va sur Mars donc loin et pas facile à corriger ... et qui doit un tant soit peu être bien codé, ou plus proche, une machine qui doit maintenir en vie quelqu'un, ben voilà, pour cela il faut de bonnes pratiques.

Le PDF: set of rules for writing safety critical code, published by NASAs Jet Propulsion Laboratory (pixelscommander.com/wp-content/uploads/2014/12/P10.pdf)

Skill Builder: Write Your Code Like NASA Does

makezine.com skill-builder-write-your-code-like-nasa-does.jpg
makezine.com

Note: ces bonnes pratiques ne s'appliquent pas qu'au code/à la programmation. Il suffit de les adapter à votre sauce, à vos besoins!
Le résumé donné peut suffire pour "la vie de tous les jours"

  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.

J'inverserai juste la 2. et la 1. ... écrire un test unitaire de ce qui doit marcher d'abord et seulement ensuite coder ;)

La vidéo:

Haut de page