bannerc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Set Data
hiddentrue
namereftab
2
Tabsetup
01. Introduction
12. Resources
Div
idtabs-1

1. Introduction

Excerpt

This topic discusses the issues of having dead or dormant code in software that is safety critical. 

1.1 What is Dead Code or Dormant Code?

               Definitions:

  • Code, definition, function or configuration that is never used during runtime.
  • Section of source code that is executed, but the result is never used.
  • Logic branch that is unreachable or can never be executed under current configuration
  • Configuration items that are no longer called or utilized.
  • Summation: Dead/Dormant code is:
    • Code that is not executed.
    • Function that is not used.
    • Configuration that is not used.
    • A result of a function that is never used.

Note: Dead and Dormant code are, in this respect, considered fundamentally the same thing.
For the remainder of this topic, “Dead” code will be used to refer to both “Dead” and “Dormant” code.

1.2 Why are Dead Code and Dormant Code problems?

Potential problems with Dead/Dormant Code:

  • Makes the Code Base harder to understand and maintain (Increases cost and time)
  • Increases inefficiency of the system.
  • Increases potential instability and thus increases risk.
  • Results in a greater chance for unexpected or undesired result.

1.3 What are the best practices to use with Dead/Dormant Code?

What should be done to minimize Dead Code?

  • Dead code should be identified. Comment statements might be one way to identify the Dead code.
  • Dead code should be removed if possible.
  • Avoid duplication of code or functions. This leads to Dead code as well as increased difficulties in maintaining the Code Base. If portions of the code will be used multiple times, put them in a function that can be called.
  • If available, use analysis tools for identifying Dead code. These tools are separate from compilers. Some compilers identify the Dead code and don’t put it into the executable, but that still leaves the Dead code in the Code Base that is being maintained.
  • Ensure 100% code coverage for unit testing. This will help to determine if any Dead code exists. If 100% coverage cannot be achieved, determine and document why and determine the potential risk.


General Guidelines and best practices to manage Dead Code.

  • Avoid duplication of code or functions. This often leads to Dead code during future code modifications.
  • When using a compiled language, do not depend on the compiler to remove any Dead code. Any identified Dead code should be actively removed before the compilation.
  • Use a Code Analysis tool to identify Dead code.
  • Avoid using test or temporary code inside the Code Base. This includes all code that is not directly needed for operation in a live environment. If using test code within the code base is required for testing purposes, it must be removed before the code base is released.
  • Verify configuration items are documented and utilized. If not utilized, they should be removed.
  • Each development team should have established procedures for identifying, handling and removing Dead code. These procedures should be tailored to the needs of each team to facilitate requirements and ensuring stable and reliable code.
  • Before removing Dead code, ensure it is not being utilized by other processes. This is especially important in software that is used between multiple projects and purposes.

For more discussion and some examples, see  the 9.06 Dead Code Exclusion in the Software Design Principles tab.

Div
idtabs-2

2. Resources

2.1 References

refstable-topic

Show If
groupconfluence-users
Panel
titleColorred
titleVisible to editors only

Enter necessary modifications to be made in the table below:

SWEREFs to be addedSWEREFS to be deleted
P6 - Dead Code Exclusion




SWEREFs NOT called out in text but listed as germane: none

SWEREFs called out in text: none

2.2 Tools

Include Page
Tools Table Statement
Tools Table Statement