how NASA writes space-proof code
Low Level Learning・2 minutes read
NASA has a set of rules called the Power of 10 for code safety, advising against recursion and recommending stack memory over the Heap. Functions should be concise, variables should be scoped close to their use, and loops should have fixed upper bounds to limit memory allocation and debugging issues.
Insights
- NASA's "Power of 10" rules emphasize code simplicity by limiting recursion, setting loop bounds, favoring stack memory over Heap, and advocating for concise functions with clear, minimal scope variables.
- Prioritizing safety and ease of static analysis, NASA's guidelines underscore the importance of clear, single-purpose functions within a limited line count, enhancing code readability and testability while minimizing memory bugs.
Get key ideas from YouTube videos. It’s free
Recent questions
What are NASA's coding rules?
NASA follows the Power of 10 rules for code safety and static analysis, emphasizing simple control flow, stack memory usage, and concise functions.
Why does NASA avoid recursion?
NASA avoids recursion to adhere to the Power of 10 rules, ensuring code simplicity, safety, and ease of static analysis.
What memory type does NASA recommend?
NASA recommends using stack memory over the Heap to prevent memory bugs and limit memory allocation for code efficiency.
How long should functions be according to NASA?
NASA suggests keeping functions concise, around 60 lines, to maintain readability, testability, and adherence to the Power of 10 rules.
Where should variables be declared in NASA's coding guidelines?
NASA advises declaring variables at the lowest scope possible for readability and testability, aligning with the Power of 10 rules for code simplicity and safety.
Related videos
WsCube Tech
Variables in R Programming | Complete Explanation | R Programming Tutorial for Beginners #6
Fireship
Reacting to Controversial Opinions of Software Engineers
Thriving Technologist
How Senior Programmers ACTUALLY Write Code
Xylem Commerce Plus Two
Plus Two Computer Application - Functions & Web Technology | Xylem Plus Two Commerce
ThePrimeTime
The Best Software Engineering Advice | Prime Reacts