Availability Guide for Application Design
Availability Guide for Application Design—525637-004
9-1
9 Minimizing Programming
Errors
For an application to be continuously available, you need to ensure that the code you
write is as free from defects as possible. The hardware and software design of
NonStop systems and appropriate design of the application go a long way toward
keeping an application running. However, fault-tolerant design is not a substitute for
quality, error-free code.
Fault-tolerant design does not protect you against most deterministic errors in your
application program. Even enhanced compilers can only help find syntactic errors;
semantic errors will go undetected. Moreover, some studies indicate that even mature
production code contains, on average, about 3 errors for each 1000 lines of code.
This section describes several techniques that can help you reduce the errors in your
code or reduce the impact of coding errors through appropriate reporting. For
minimizing programming errors, there is no best approach that works for every
program. The best approach depends on the specific needs of your application and on
the extent to which you can tolerate errors in your code. The following software
engineering practices, however, will help reduce coding errors:
•
Using reusable program modules
•
Establishing a design methodology for eliminating software faults, especially those
errors that are not obvious
•
Determining the right way to handle errors and who to inform
•
Establishing a development methodology that emphasizes up-front inspections and
testing to build quality into the application by resolving defects early in the
development phase when defects are cheaper and quicker to fix
The remainder of this section describes these techniques.
Using Reusable Program Modules
Reusable program modules reduce programming errors by reducing the number of
times that an algorithm needs to be coded and tested.
In a typical development environment, the same or similar services are needed in
different parts of an application and across different applications. Services such as
security, error handling, logging, instrumentation, print handling, naming, user event
delivery, version control, file transfer, and help are often implemented several times
within applications or across different applications.
Using traditional programming methodology, software developers typically create a
new implementation of a common service by copying existing routines and modifying
them to suit the needs of the new implementation. No attempt is made to link the new
implementation of the service with the implementation it was copied from. Errors found
and fixed in either implementation remain in the other implementation.