Availability Guide for Application Design
Minimizing Programming Errors
Availability Guide for Application Design—525637-004
9-3
Design Methodology for Eliminating Software Faults
Object-oriented techniques make use of the concepts of object, class, and inheritance
to support reusable modules that reduce the propagation of errors. Here, a new object
class is built from an existing object class without modifying the existing code. The new
code might contain attributes and behavior in addition to those inherited from the
original object class, but the inherited code itself is not changed. Hence, the new code
cannot cause the existing code to break.
When the new class definition is compiled, the inherited code is automatically included.
Any modifications in the original class, such as bug fixes and feature enhancements,
are included in the new class when it is next compiled. This technique ensures that all
instances of inherited code remain consistent. The generated code is inherently more
robust because:
•
The inherited code is more thoroughly tested through reuse.
•
Errors need be found and fixed only once because the same code source is
reused; object classes that inherit code in this way get the latest version each time
the object class is compiled.
An in-depth treatment of object-oriented programming is beyond the scope of this
manual and is unnecessary. Refer to the many books and papers written on this
subject for additional information.
Design Methodology for Eliminating Software
Faults
Eliminating software faults requires doing more than simply checking for anticipated
errors. The defensive programming techniques described here would have you check
for the kind of errors that are not supposed to happen. For example, given good design
and implementation technology, it should not be necessary to perform bounds
checking within array references, because object-oriented or structured programming
design techniques should ensure that bounds violations do not occur. Defensive
programming, however, would have you perform bounds checking regardless.
Common Causes of Software Faults
The following list describes the most common causes of software faults on HP
NonStop systems. The problems are listed in prioritized order with the most common
problems listed first. The intention of this list is to help you avoid as many of these
problems as possible. The list highlights potential problems to be aware of when
coding your application. Hence, it helps you position detectors in the most likely places
in your code for detecting unexpected errors.
The most common causes of software faults are:
1. Unexpected situations
These problems occur because of inadequate state checking, unexpected errors,
unexpected sequences of events, and race conditions.