The Importance of Testing and Debugging
tions at all until ECMAScript version 3. Instead of alerting a user to an error in a program
it just failed silently in the background, and this is sometimes still the case. It might seem
like a good idea at first, but the error might give unexpected or incorrect results that nobody
spots, or lurk in the background for a long time before causing the program to crash spectac-
ularly. Failing silently makes errors difficult to spot and longer to track down.
For this reason, ninjas should ensure that the code they write fails loudly in development so
that any errors can be identified and fixed quickly. In production, a ninja should try to make
the code fail gracefully (although not completely silently―we still need to know there's
been an error) so that the user experience is not affected, if possible. This is achieved by
making sure exceptions are caught and dealt with and code is tested rigorously.
Search WWH ::