10 rules to code like NASA (applied to interpreted languages)

10 Aug 2019 . Tips and Tricks . 123 views

Hello

I found some good tips to write robust and maintainable software. After reading the post, here is the extraction of this article-

Rule 1 — Don't use goto, rationalize the use of continuing and break, don't use the switch.

Rule 2 — Prove that your problem can never create runaway code.

Rule 3 — To do so, limit the size of it. Usually using pagination, map/reduce, chunking, etc.

Rule 4 — Make code that fits in your head. If it fits in a page, it fits in your head.

Rule 5 — Check that things are right. Fail when wrong. Monitor failures. See rule 7.

Rule 6 — Don't use global-ish variables. Store data in the smallest possible scope.

Rule 7 — Let exceptions bubble up until you properly recover and/or report them.

Rule 8 — If you use transpilers, make sure that they solve more problems than they bring

Rule 9.1 — Don't use references even if your language supports it

Rule 9.2 — Copy arguments instead of mutating them, unless it's the explicit purpose of the function

Rule 9.3 — Use as many type-safety features as you can

Rule 10 — Use several linters and tools to analyze your code. No warning shall be ignored.

Read Full Article