| The Dead Code Detector is used to find dead code. What is dead code?
Dead code is code which is not used by other code? It exists, but it not
used. Unused code is clutter, which can generally be a candidate for
removal.
When performing dead code detection, there are various sets of files/classes
which must be identified. An analogy of the dead code analysis as
a foot race is used to help clarify each of these sets:
- The direct users is the set of Classes which will always be
parsed to determine what code they use. This set is the starting point of
the race.
- The indirect users is the set of Classes which will only be
parsed if they are accessed by code in the direct users set, or
in the indirect users set. This set is the course of the race.
- The dead code candidates are the set of Classes which are the
focus of the dead code detection. This set is the finish line of the
race.
Typically there is intersection between the set of direct users,
indirect users and dead code candidates, although it is
not required. If the sets are defined too tightly, there the potential for
a lot of code to be considered as dead code. You may need to expand the
direct users or indirect users sets, or explore using
different options.
|