Page History
| Excerpt Include | ||||||
|---|---|---|---|---|---|---|
|
| Show If | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
| 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.
Excerpt Include | SITE:Q-004 Coding Standards and Code Reviews | SITE:Q-004 Coding Standards and Code Reviews | 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
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: SWE-024 - Plan Tracking | SWE-058 - Detailed Design | SWE-060 - Coding Software | SWE-063 - Release Version Description | SWE-135 - Static Analysis | SWE-136 - Software Tool Accreditation | SWE-185 - Secure Coding Standards Verification | SWE-207 - Secure Coding Practices |
6.2 Other Lessons LearnedNo other Lessons Learned have currently been identified for this requirement. Div |
7. Software AssuranceExcerpt Include | SWE-061 - Coding Standards | SWE-061 - Coding Standards | 7.1 Tasking for Software Assurance
7.2 Software Assurance Products
Expand |
Include Page | SITE:Definition of Objective Evidence | SITE:Definition of Objective Evidence | 7.3 Metrics
7.4 GuidanceTask 1: Review the project software development/management plan to learn what kind of software coding standards, methods, rules, and principles are used for the project. The coding standards could include any project-defined standards that dictate the safe use of code, secure coding standards, reliability coding standards, etc. They may also include a set of “principles” or best practices that have been collected for particular software applications, such as principles for developing flight software. These coding standards and principles are reviewed by software assurance during the development and selection of the project processes, as per SWE-013 - Software Plans. After becoming familiar with these standards, practices, and principles, analyze the software code using the static analyzers' results to help determine whether these standards, methods, and principles are being used consistently. Any risks or issues should be brought up with project management. Task 2: Software assurance will perform independent static code analysis on the coding standard practices, methods rules, and principles. They should review the results of the static code analysis runs to determine whether the project's coding standards, etc., are being followed. Results should be reported to the project management at the end of the analysis. Information on code standard usage, static code analysis tools, their effectiveness, and the developers’ responses to the results should also be shared with the project management. |


