Page History
...
| Tabsetup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General Coding Standard Guidance Planning for the adoption and use of coding standards at the beginning of a software development activity sets the right tone and approach for the development team. Software coding standards are classified by language, usage, and severity levels. Language-specific rules and best coding practices are usually determined by experts in the particular language [e.g., C++, ADA] and tailored as needed by the project. The user sets usage types and severity levels.
Over time, correlations between bugs and coding practices resulted in rules that helped prevent coding errors from occurring.
In a team environment or group collaboration, the use of coding standards ensures uniform coding practices, reduces oversight errors and the time spent in code reviews. When NASA software development work is outsourced to a supplier (see Topic 7.3 - Acquisition Guidance), having a set of coding standards in place helps ensure that the contractor's code meets quality requirements mandated by NASA in the NASA Software Assurance Standard, NASA STD 8739.8.
A coding standard document may be written as a general document that is independent of any project. Project-specific needs are then added as amendments to the document. Note there is an important difference between a coding style and a coding standard. A coding style specifies how you indent lines or employ tabs and spaces to make the code easier to read by the software development team. A coding standard, which often includes a coding style, goes beyond just how to name a variable. It tells you how that variable is to be treated and when it is to be used (and not used).
One way to tell the difference between a coding style and a coding standard is to assess the functionality of code changed due to applying the coding style or standard. If the coding style was not followed, the code should still work the same way, with the same behavior and safety checks. However, if the coding standard is not correctly applied, the code's "safety" and/or functionality have likely changed. A coding standard is more important than a coding style since the standard affects the code's behavior. How Coding Standards are Classified Software coding standards are classified by language, usage, and severity levels. Industry experts determine Language-specific rules and best coding practices in that particular language. The user sets usage types and severity levels.
Coding standards should address (for all the languages used):
The following items may be an integral part of the coding standard to the extent their implementation affects the execution of the software. Otherwise, they are part of the coding style.
Adherence and Verification
Assuring the developed software's adherence to the coding standards provides the greatest benefit when followed from software development inception to completion. Coding standards are selected at the start of the software development effort. Verification activities of the software work products include reviews, such as peer reviews and inspections (see SWE-087), and assessments of how the coding standards are used to develop the software work products. Automated tools for assessing adherence to standards at appropriate reviews, or even on a batch mode run overnight, will assist the project team in adherence and verification. Training should be provided for the software development team to use the logic model checkers for the analysis and verification of flight software.
Manual analysis to verify the complete application of safety or security coding standards is all but impossible.
MISRA and CERT-C Coding Standards
Two example coding standards to improve safety, reliability, and security in software systems are MISRA, and CERT C.MISRA C has become the de facto standard for embedded C programming in safety-related industries and is also used to improve software quality even where safety is not the main consideration. How to Interpret the "and/or" Phrase in the Requirements Statement The "and/or" in the text of the requirement statement is meant for flexibility in tailoring the requirement to the project's needs. Inappropriate (e.g., less "critical") settings, a subset of ”methods, standards, criteria” would be sufficient and compliant. For human-rated applications, the project would want to cover methods, standards, and criteria (e.g., the use of the Klocwork® Insight tool as part of the method, MISRA C (a software development standard for the C programming language developed by MISRA (Motor Industry Software Reliability Association) as part of the standards, avoidance of the project's restricted language constructs as criteria, etc.). NASA-specific coding standards information and resources are available in Software Processes Across NASA (SPAN), accessible to NASA users from the SPAN tab in this Handbook. Additional guidance related to the planning and control of software coding standards and where they may be used may be found in the following related requirements in this Handbook:
|
...


