
218
Chapter 15 Code Smells
Ariane
The maiden fl ight of the Ariane 5 rocket was a complete disaster: The
rocket blew up only 37 seconds after takeoff. The culprit was a seem-
ingly innocuous bit of code that was used only while the rocket was on
the ground but unfortunately was left running for the fi rst 40 seconds of
fl ight. When it tried to assign a 64-bit number representing the sideways
velocity of the rocket to a 16-bit fi eld, the navigation computer decided
that the rocket was going the wrong way! It tried to correct the course,
but the sudden change in direction tore the booster rocket apart. While
this is not quite an example of Test Logic in Production (page 217), it
certainly does illustrate the risks associated with this type of error.
Could this disaster have been prevented by use of automated tests? While
it is diffi cult to say with certainty, and one could certainly claim that any
number of process changes could have detected this problem before it
occurred, it is conceivable that automated tests could have averted this
catastrophe.
In particular, a test should have addressed the boundary condition—
namely, what happens when a number exceeds the maximum value stor-
able. Such a test would have prevented an exception from occurring for
the fi rst time ever in production.
In addition, the presence of the tests from the Ariane 4 version of the
rocket would have documented the maximum down-range velocity. It is
quite possible that these tests would have been updated when the Ariane
5 software was being developed and that the new tests would have failed
because of the new rocket’s higher speed.
For a slightly more detailed (and very interesting) description of “the
little bug that could,” visit http://www.around.com/ariane.html.
Impact
Code that was not designed to work in production and that has not been veri-
fi ed to work properly in the production environment could accidentally be run
in production and create serious problems.
The Ariane 5 rocket blew up 37 seconds after takeoff on its maiden fl ight
because a piece of code that was used only while the rocket was on the ground
was left running for the fi rst 40 seconds of fl ight. This code tried to assign
a 64-bit number representing the sideways velocity of the rocket to a 16-bit
Test
Logic in
Production