You are on page 1of 3

A T R A N D O M

If You Didn’t Test It, of requirements; dedicated validation


and verification teams; designing with
a built-in safety margin; formal verifi-
cation where possible; and testing, test-

It Doesn’t Work ing, testing. If you didn’t test it, it


doesn’t work.
In some cases, computers have
become fast enough to permit testing
every combination of bit patterns. If
Bob Colwell
you’re designing a single-precision
floating-point multiplier, you know the
unit is correct because you tested every
cience is supposed to learn possible way it could be used. Now all

S
more from its failures than you have to do is worry about resets,
its successes. Schools ac- protocol errors into and out of the
tively teach trial and error: unit, electrical issues, noise, thermals,
If at first you don’t succeed, crosstalk, and why your boss didn’t
try, try again. On the other hand, we’re smile at you when she said good morn-
told to look before we leap but that he ing yesterday.
who hesitates is lost—so maybe we’re
all doomed no matter what. Testing to saturation
This notion that trying and failing is Most things But many, perhaps most, things you
normal, and natural, can lead you design can’t be tested to saturation.
astray in your professional life, how-
you design can’t Double-precision floating-point num-
ever. In practice, it’s a lot harder to get be tested to bers have so many bit patterns that it’s
a conference paper accepted that is of hard to see when, if ever, such units
the form, “We wanted to help solve saturation. could be tested to saturation. Two to
important problem X, so we tried Y, the 64th power is an extremely large
but instead of the hoped-for result Z, number, and there are usually two
we got yucky result Q.” And when I operands involved. And that’s for a
say “a lot harder,” I mean “there’s no Barry would say, I’m not making this functional unit with a fairly regular
way.” This is true in science as well as up.) Of course, prospective authors design and state sequence. Saturation
engineering, and it’s responsible for the know this, and they would be in dan- testing of anything beyond trivial soft-
overall impression you get when read- ger of biasing their results toward the ware is often even more out of the
ing conference proceedings: Everything most positive light if it weren’t for their question.
other people try works perfectly. dedication to the scientific ideal. (Are So it behooves us to try to anticipate
You’re the only one who goes down you buying any of that? Me neither.) how our designs will be used, certainly
blind alleys and suffers repeated fail- Scientists get to run their experi- under nominal conditions, but also
ures. ments multiple times, and they can under non-nominal conditions, which
There’s a good reason why confer- gradually reduce or eliminate sources usually place the system under higher
ences and journals are biased this way. of systematic errors that might other- stress. Programmers have a range of
Sometimes there’s a very fine line wise bias their results. Engineers tend techniques at their disposal, such as
between good ideas that didn’t work to get only one chance to do some- defensive programming (checking
out and just plain stupid ideas. And thing: one bridge to build, one CPU to input values before blindly using
since there are a thousand wrong ways design, one software development pro- them), testing assertions (automatically
to do something for every way that ject to crank out late, slow, and.… checking for conditions the program-
works, a predisposition for papers with Whoops. I got carried away there. mer thought were impossible), and
positive results is a quick, generally always checking function return val-
effective filter that saves conference ANTICIPATION ues. Engineers design in fail-safe or fail-
committees a lot of time. (They need Because engineers generally can’t test soft mechanisms because they know
to save that time so they can use it later, their creations to the point of satura- that the unexpected happens all the
debating how to break it to a fellow tion, they must make do with a lot of time. If you’ve ever driven a car that
conference committee member that substitutions: anticipation of all possi- had the check-engine-light illuminated,
they want to reject his paper. As Dave ble failure modes; a comprehensive set you were in one of those modes.

May 2002 11
At Random

Real-world uses This is one area of engineering in left to do anything about it. Think
One of the more difficult tasks in which you can’t simply overwhelm the locally and globally.
engineering is trying to imagine all of problem with force. You want an ele-
the conditions under which your cre- gant, intelligent, balanced creation that VALIDATION AND VERIFICATION
ation will be used in the real world— meets all of the specs and also the intent Did I mention this: If you didn’t test
or, if you’re an aerospace engineer, in of the product, stated or otherwise— it, it doesn’t work. In DragonFly:
the real universe. There are user inter- not a sandbagged, bloated, turkey of a NASA and the Crisis Aboard MIR
faces to consider: Automobile manu- design. Yes, it will take compromises, (HarperCollins, New York, 1998),
facturers long ago resigned themselves but the magic is in getting those com- Bryan Burrough gives a riveting
to designing to the lowest common promises right. Engineers know elegant account of several near catastrophes
denominator of the human population designs when they see them. Aspire to on the Russian space station.
in terms of intelligence applied to the produce them. In one instance, an oxygen genera-
operation of a motor vehicle. But idiot- tor catches fire, and a blowtorch-like
proofing is difficult precisely because flame begins to bloom. Jerry Linenger,
idiots are so clever. The tragedy of the the sole American astronaut, grabs an
There are also legal concerns—juries commons occurs when oxygen mask, but it doesn’t work. He
that award damages to people who designers decide to grabs another one that does work. The
think driving with a hot cup of coffee borrow more of the station commander leads Linenger to
between their legs is a reasonable chip area than they the station module where the fire extin-
proposition may well fail to grasp the were allocated. guishers are kept. Linenger grabs one
engineering tradeoffs inherent in any “but is startled to find it is secured to
design. How do we protect idiots from the wall.” Both men pull at it, but the
themselves? wall wins. They try another extin-
Tragedy of the commons guisher, with the same outcome.
DESIGNING WITH MARGIN Always keep in mind the “tragedy of Later analysis revealed that the
As a conscientious designer, you try the commons.” The idea is that there transportation straps for the fire extin-
to anticipate all the ways your design are shared resources, initially allocated guishers were still installed—in the
may be used in the future. Since you do in the hope of having enough for all, intervening 19 months of service, no
outstanding work, you expect that you but overall management of those one had thought to wield the wrench
or someone else will reuse your code resources is essentially a distributed required to remove them. In perfect
or your silicon in the future. So you try local function. hindsight, this also suggests that what-
to guess what that future designer will If you’re a silicon chip designer, your ever fire drills had been performed in
want and strive to provide it. job is to implement your piece of the those months weren’t realistic enough
You’ve also been around this par- design in the area you were allocated, or the astronauts would have found
ticular block a few times before, so and to do so within the power, sched- the problem earlier.
you build in some flexibility because ule, and timing constraints. You know
you know that project management that those constraints are somewhat An important distinction
will change its mind about certain fungible: If you had more schedule NASA draws a useful distinction
major project goals as you go along. time, you could compact your real- between validation and verification.
And since debugging was such a bear estate footprint. With more thermal Verification is the act of testing a design
last time, you allow for lots of debug power headroom, you could meet your against its specifications. Validation
hooks and performance counters. If clocking constraint. tests the system against its operational
you keep traveling down this road, The tragedy of the commons occurs goals.
you’re going to make yourself crazy. when, faced with the same problems An example of why the distinction
Yes, more than you are now. You need you face, your fellow designers decide is important comes from Endeavour’s
to compromise. to borrow more of the chip area than maiden flight, when it tried to ren-
they were allocated. It appears to each dezvous with the Intelsat satellite. As
The art of compromise of them that they’re using only a tiny it turned out, the “state-space” part of
Engineering is the art of compro- fraction of the unallocated chip space, the shuttle’s programming had been
mise: now versus later, concise versus while substantially boosting the die done with double-precision floating-
generalized, schedule versus thor- area available to their particular func- point arithmetic, and the “boundary
oughness. And all around you, the tion. And so they are. But if everyone checking” part was done with single-
other designers are falling behind and does that, the chip’s overall die size precision arithmetic. The shuttle’s
asking for help—your help. will exceed the target, with no margin attempted rendezvous didn’t converge

12 Computer
to a solution due to this mismatch; would happen if he tried to catch a levels of intelligent thought, and he uses
only a live patch from the ground field goal. For readers who don’t fol- numerical sequences as the clearest
saved the mission. low American football, a field goal is analogy-generators. You remember
If the specs called for double preci- an attempt by the offensive team to these—What comes next in this se-
sion, verification of the state-space kick the ball between the goal posts at quence: 5, 10, 15? Yep, 20 would be
code would never find this potential the end of the field. During a field goal my bet too.
problem: different specs for different attempt, the offense just tries to keep So what comes next in the following
code. Validation, on the other hand, the defense from blocking the kick. sequence: 0, 1, 2? It has to be 3,
could reasonably have been expected There would be no point in sending doesn’t it? But wait, why would I give
to detect this mismatch before the any offensive players downfield, so you a trivial sequence and claim it’s
astronauts encountered it hundreds of nobody ever does. going to stimulate your brain? What
miles above the earth. else could it be, if not 3?
I’m very fond of validation. Verifi- Even when I give you the answer,
cation is absolutely necessary, and it’s Having a validation you probably still won’t know where
as important (and difficult) a task as mindset that allows an this is coming from. The answer is 0,
design or architecture. In my experi- independent thinker to 1, 2, 720!. That’s 720 factorial: 0, 1, 2,
ence, however, the job of making sure step outside a design 720! = 0, 1, 2, 6!! = 0, 1!, 2!!, 3!!!.
a design correctly implements its specs project’s orthodoxy is The important thing about this
isn’t likely to be forgotten or over- absolutely vital. example is not the actual math
looked. Verification may not always be involved per se. It’s that when you first
done very well, but it probably won’t saw the sequence 0, 1, 2, your imme-
be skipped entirely. Validation, on the diate instinct probably was to answer
other hand, is often misunderstood, The validator was unswayed by the “3” and move on. But some other part
and management sometimes doesn’t spec that there’s no point in trying to of your brain, your Validation Reflex,
remember why it’s so necessary. catch the ball after it has been kicked; became instantly suspicious and said,
in true validation hero fashion, he sim- “Not so fast. Something’s not quite
Seeing the big picture ply noticed that it didn’t seem to be right here.”
In my experience, after months or impossible. After trying for a couple of That’s the voice you must learn to
years of intensive design and develop- hours, he succeeded in doing it. Since hear to do truly outstanding valida-
ment, the designers are tired, they’re the game’s designers had never con- tion. That’s the instinct that allows you
being pressured to hit their production ceived of anyone trying to do such a to take a step back from the implicit
schedule, and they just want to finish goofy thing, the game’s specs didn’t assumptions that others around you
the project. Some part of them really include a requirement for how to han- are making so you can go in a differ-
doesn’t want to hear that there might dle it. As the validator suspected, the ent direction where you may see some-
be anything wrong with their baby. game didn’t handle the situation very thing everyone else is missing.
The architects often have moved into well—it locked up.
the initial phase of another design, and
they may not even be available, much Stepping outside the box eah, I know—I cheated a little
less actively engaged in final testing. So
the validation folks are the only ones
left who can try to see the Big Picture.
Having a validation mindset that
allows an independent thinker to step
outside a design project’s orthodoxy is
Y with that math sequence. It
doesn’t seem quite fair to throw
in factorials when the original
Especially on long design projects, absolutely vital. Such people often are sequence didn’t have them. You could
fundamental changes may have the last line of defense between some- complain to Hofstadter. But you
occurred in the overall product land- thing that’s overlooked in design and should read his book first.
scape that haven’t been fully incorpo- a user who isn’t happy with the prod- In the meantime, what’s next in this
rated into the specs: Competition has uct—or worse. sequence: If you didn’t test it, …? ■
arisen, a lawsuit may have been Although it’s not a common experi-
resolved in an unfavorable direction, ence in most people’s daily lives, you
last-minute design changes were made know what this mindset feels like. An
that won’t have benefited from the years example borrowed from Douglas Bob Colwell was Intel’s chief IA32
of testing the design otherwise enjoyed. Hofstadter’s Fluid Concepts and Crea- architect through the Pentium II, III,
Here’s an example of what I mean. tive Analogies (Basic Books, New York, and 4 microprocessors. He is now an
While testing the Madden NFL 99 PC 1995) simulates it. Hofstadter believes independent consultant. Contact him
game, a validator wondered what that analogies are among the highest at bob.colwell@attbi.com.

May 2002 13

You might also like