UNDER CONSTRUCTION
In this example, the Div bodies were distributed into Expand macros on the left side of the page. Click on a link in one of the rows below to open the content. Multiple content areas may be opened at the same time.
1. Requirements4.4.3 The project manager shall select, define, and adhere to software coding methods, standards, and criteria. 1.1 NotesNPR 7150.2, NASA Software Engineering Requirements, does not include any notes for this requirement. 1.2 HistorySWE-061 - Last used in rev NPR 7150.2D
1.3 Applicability Across Classes Class A B C D E F Applicable? Key: | ||||||||||||||||||||||||||||||
2. RationaleTo ensure safety, security, reliability, quality, maintainability, readability, and testability of the NASA code products. | ||||||||||||||||||||||||||||||
3. GuidanceNASA programs and projects have multi-year life cycle times. Often the software personnel who develop the original software work products move on to other projects. These developers are then backfilled on the team by other developers for the remainder of the development, operations, maintenance, and disposal phases of the life cycle. This personnel turnover process may occur several times during the project's life cycle. The use of uniform software coding methods, standards, and/or criteria ensures uniform coding practices, reduces errors through safe language subsets, and improves code readability. Verification that these practices have been adhered to reduces the risk of software malfunction for the project during its operations and maintenance phases. See also SWE-060 - Coding Software, There are five key benefits of using coding standards:
Coding standards help prevent or reduce unsafe coding practices such as defect-prone coding styles, security issues from specific coding sequences, and numerous coding errors, mistakes, and misunderstandings. NESC report on Alternative Software Programming for Human Spaceflight "Coding standards are the ‘materials and manufacturing standards’ for implemented software... The reduction in effort by simply adhering to a coding standard that can be tested through automation is the one certification process that truly has no other efficient verification method. ... As security becomes an issue, security coding standards should also be applied.” 4763.1 General Coding Standard GuidancePlanning 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. To assist you in fulfilling this requirement, interpret the text in section 1 as "software coding methods," "software coding standards," and "software coding criteria." Also, interpret the terms "methods" and "criteria" as indicative of the software developer's style. Correlations between bugs and coding practices resulted in rules that helped prevent coding errors from occurring. These activities resulted in recommendations to develop and use coding standards. In a team environment or group collaboration, the use of coding standards ensures uniform coding practices and reduces oversight errors and the time spent in code reviews. When NASA software development work is outsourced to a supplier (see 7.03 - Acquisition Guidance), having a set of coding standards in place helps ensure that the 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 that 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). See also PAT-022 - Programming Practices Checklist, 3.2 How Coding Standards are ClassifiedSoftware coding standards are classified by language, usage, and severity levels. Industry experts determine Language-specific rules and best coding practices in that particular language. 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.
3.3 Adherence and VerificationSoftware Certification – Coding, Code, and Coders “Code should be checked against the standards with the help of state-of-the-art static source code analyzers. ... Flight code should be checked nightly for compliance with a coding standard and subjected to rigorous analysis with state-of-the-art (static source code analysis tools). The warnings generated by each of these tools are combined with the output of mission-specific checkers that secure compliance with naming conventions, coding style, etc. Also, all warnings, if any (there should be none), from the standard C compiler, used in pedantic mode with all warnings enabled, should be provided to the software developers... (who) are required to close out all reports before a formal code review is initiated. In peer code reviews, an additional source of input is provided by designated peer code reviewers... Separately, key parts of the software design can also be checked for correctness and compliance with higher-level design requirements with the help of logic model checkers.”477 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 - Software Peer Reviews and Inspections for Requirements, Plans, Design, Code, and Test Procedures), and assessments of how the coding standards are used to develop the software work products. See also Topic 7.10 - Peer Review and Inspections Including Checklists. 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. 3.4 MISRA and CERT-C Coding StandardsNESC report on Alternative Software Programming for Human Spaceflight “The CERT C Secure Coding Standard is composed of 89 rules and 132 recommendations for producing secure code. It is recommended that compliance with a standard like CERT C be performed by a static analyzer, depending on program size and complexity. A source code static analysis tool meeting ISO/IEC TS 17961 conformance is recommended. The following quote from the author of the second edition of the CERT C Coding Standard describes what static analysis for conformance can imply. While the application of these rules and recommendations does not guarantee the security of a software system, it does tell you ...that the software was developed to a set of industry-standard rules and recommendations developed by the leading experts in the field. ... that ...time and effort went into producing code that is free from the common coding errors that have resulted in numerous vulnerabilities ...over the past two decades ... that the software developers who produced the code have done so with a real knowledge of the types of vulnerabilities that can exist and the exploits that can be used against them, and consequently have developed the software with a real security mindset.” 476Two 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. See also SWE-023 - Software Safety-Critical Requirements, SWE-157 - Protect Against Unauthorized Access, SWE-185 - Secure Coding Standards Verification, 3.5 How to Interpret the "and/or" Phrase in the Requirements StatementThe "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. 3.6 Additional GuidanceAdditional guidance related to this requirement may be found in the following materials in this Handbook:
3.7 Center Process Asset LibrariesSPAN - Software Processes Across NASA See the following link(s) in SPAN for process assets from contributing Centers (NASA Only).
| ||||||||||||||||||||||||||||||
4. Small ProjectsSmaller projects may consider using previously developed/tailored coding methods, standards, and guidelines rather than developing their own. These standard applications may be available in the software Process Asset Library (PAL) of other Centers, if not available at the performing Center. | ||||||||||||||||||||||||||||||
5. Resources5.1 References[Click here to view master references table.] No references have been currently identified for this SWE. If you wish to suggest a reference, please leave a comment below. 5.2 ToolsTools to aid in compliance with this SWE, if any, may be found in the Tools Library in the NASA Engineering Network (NEN). NASA users find this in the Tools Library in the Software Processes Across NASA (SPAN) site of the Software Engineering Community in NEN. The list is informational only and does not represent an “approved tool list”, nor does it represent an endorsement of any particular tool. The purpose is to provide examples of tools being used across the Agency and to help projects and centers decide what tools to consider. | ||||||||||||||||||||||||||||||
6. Lessons Learned6.1 NASA Lessons LearnedThe NASA Lessons Learned database contains the following lessons learned related to coding standards:
The reader of these lessons learned can also indicate that the use of tailored coding standards for a new project raises the potential for error if extensive reuse of software work products is anticipated.
6.2 Other Lessons LearnedNo other Lessons Learned have currently been identified for this requirement. | ||||||||||||||||||||||||||||||
7. Software AssuranceThe page could not be found. 7.1 Tasking for Software AssuranceFrom NASA-STD-8739.8B 1. Assure the project manager selected and/or defined software coding methods, standards, and criteria. 2. Analyze that the software code conforms to all required software coding methods, rules, and principles.
7.2 Software Assurance Products
The SA independent analysis of the software code to the software coding standard, including any risk or issues. Objective Evidence
Objective evidence is an unbiased, documented fact showing that an activity was confirmed or performed by the software assurance/safety person(s). The evidence for confirmation of the activity can take any number of different forms, depending on the activity in the task. Examples are:
7.3 Metrics
See also Topic 8.18 - SA Suggested 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. 7.5 Additional GuidanceAdditional guidance related to this requirement may be found in the following materials in this Handbook:
|


