9.01 Software Design Principles Consistent use of approved coding standards reduces the frequency of common run-time errors and promotes maintainability and re-usability. Coding standards promote readability and maintainability---important features for code that is likely to be used over a period of years or reused on other projects and SWE-061 - Coding Standards in NPR 7150.2 083 calls for the use of secure coding standards. A quality set of coding standards can improve the quality of code in many other ways as well. The list below specifies a minimal set of standards commonly found in standards for high-reliability software. These rules have been found to reduce the likelihood of run time errors. Verify the validity of input parameters at the start of each function, and take appropriate action when inputs are off-nominal. (see also 9.11 Invalid Data Handling and 9.05 Data Interface Integrity design principles) See also Topic 8.01 - Off Nominal Testing . See also Topic 8.02 - Software Reliability. A complete set of coding standards typically includes best practices, such as strict language adherence and the use of automated tools to identify problems either at compile time or run time. Language-specific guidance, domain-specific guidance, local standards for code organization and commenting, and standard file header format are often specified as well. Good coding standards have two things in common: (1) they are concise and relevant enough to be easily used by programmers and quality assurance professionals in their daily activities; and (2) they enable the use of automated code checking. The first is important for obvious reasons. A standard that is too cumbersome will quickly fall into disuse. The second is important because it reduces cost and increases the likelihood that violations that would lead to program errors will be caught before deployment. A draft version of design principles produced by the Marshall Space Flight Center (MSFC) includes guidance on the use and development of coding standards. In keeping with a “keep it simple” approach, the standard had only six mandatory practices applicable across all programming languages and allows the inclusion of language-specific and project-specific aspects. The mandatory practices strongly overlapped with the minimal set above, and the standard made it clear that the fundamental practices were not to be overridden by language-specific standards, which in turn were not to be overridden by project-specific standards. This tiered approach makes it easier for an organization to implement a basic set of standards that may be tailored on a per-project basis. This approach supports a Capability Maturity Model Integration (CMMI) Level 3 and above organization. JPL has taken a somewhat different approach. All projects are required to identify the coding standards used in the development, but no specific standard is imposed. An institutionally supported C coding standard is available. This standard is broken down into six levels of compliance, each more rigorous than the next. Projects that use the institutional standard must determine the level of compliance appropriate for their project. Projects are allowed to produce their own standard, use an alternative standard, or tailor the institutional standard. Except for a general provision concerning safety-critical software, there are no restrictions on the standards that may be used. This approach also supports a CMMI Level 3 certification. Specific coding standards in use include JPL's C Coding Standard 331 , GSFC's C Coding Standard for Flight Software 333, and GSFC's C++ Coding Standard for Flight Software 338, which is all available in the Software Processes Across NASA (SPAN) library. Another resource for coding standards is Gerard Holzmann's "Power of Ten" 417 paper. There are a number of static analysis tools that can help verify adherence to coding standards, including VectorCast, Polyspace, and Klocwork. Links to Additional Guidance materials for this subject have been compiled in the Relevant Links table. Click here to see the
Additional Guidance in the Resources tab. 6.3.1.4.1 Coding and Implementation Issues Related to Reliability 669 See also SWE-185 - Secure Coding Standards Verification, SWE-207 - Secure Coding Practices, Topic 8.02 - Software Reliability. Links to Additional Guidance materials for this subject have been compiled in the Relevant Links table. Click here to see the
Additional Guidance in the Resources tab. Additional guidance related to this requirement may be found in the following materials in this Handbook: SPAN - Software Processes Across NASA See the following link(s) in SPAN for process assets from contributing Centers (NASA Only). Lessons that appear in the NASA LLIS or Center Lessons Learned Databases. 439
See edit history of this section
Post feedback on this section
1. Principle
1.1 Rationale
2. Examples and Discussion
2.1 Additional Guidance
3. Inputs
3.1 NESC inputs
Definition of suitable coding standards and conventions: Coding standards and conventions can enhance reliability by considering such issues as:3.2 Additional Guidance
4. Resources
4.1 References
4.2 Additional Guidance
Related Links 4.3 Center Process Asset Libraries
SPAN contains links to Center managed Process Asset Libraries. Consult these Process Asset Libraries (PALs) for Center-specific guidance including processes, forms, checklists, training, and templates related to Software Development. See SPAN in the Software Engineering Community of NEN. Available to NASA only. https://nen.nasa.gov/web/software/wiki 197SPAN Links 5. Lessons Learned
5.1 NASA Lessons Learned
9.03 Coding Standards
Web Resources
View this section on the websiteUnknown macro: {page-info}