Chapter 26. The Gestalt of Testing

for RuBoard

And everyone that heareth these sayings of mine, and doeth them not, shall be likened unto a foolish man which built his house upon the sand: and the rain descended, and the floods came, and the winds blew, and beat upon that house; and it fell: and great was the fall of it.

Jesus Christ [1]

[1] The Bible . Kings James version. Matthew 7:2527.

It is early evening and the rain has just stopped . In the middle of a tan cornfield, in the center of a green patch, a white Kansas farmhouse sheds the last drops of a late afternoon shower. A rainbow arcs across the silken canopy and fades into the horizon. The sun resumes it place atop the firmament. A stately oak in front of the house stretches up into the evening sky, yawning at the change of weather, and drinking in the heavenly dew, fresh sunlight streaming through his wet limbs . A windmill turns in the light waft. Distantly, lightning flashes between earth and sky, a silent reprise of the earlier performance.

The house is gabled on either side and circumvented by an open portico that wraps it to the right, beside the driveway . It is a large porch, with broad steps and a painted handrail leading up to the house. On it, aloe plants flank the house's front door, and a wooden swing rocks itself in the breeze . A set of wind chimes, hanging on the right edge of the porch roof, begins to jingle.

The smell of ozone permeates the air. An eerie silence forebodes great danger. The animals and insects remain perfectly still. The wind chimes continue to jangle amongst themselves .

Abruptly, the wind picks up, knocking the swing against the house. Leaves and debris tumble past the house and up against it. The giant tree sways in the onslaught; the house creaks under the strain. The wind chimes jingle furiously.

Then, just as suddenly as it picked up, the wind relents, and nature's assault on the house seems over for now. After a while, a woman inside opens the wooden blinds, and the sun smiles on the little house once more. The wind chimes jingle a simple, ominous lilt, over and over, in singsong repetition.

Without warning, the tempest hits. A tornado nearly as wide as the cornfield descends in the east and churns its way toward the house. The corn is mowed under like dry winter grass; the sky fills with dirt, plants, and rubble .

The great tree is next in line. As the tornado besieges the house, it begins with the great treefaithful in his post for nigh 50 yearsangrily ripping him from the ground and tossing him aside. He lands 100 feet away, on top of the barn.

Next is the farm truck in the driveway. First the contents of the bed are sucked out in an instant and whirled away, then the truck itself is vacuumed up into the giant plume and hurled skyward. It lands upside down on top of the barn, beside the tree, crashing through the roof and coming to rest on the hay bales inside.

The last victim is the house itself. As the vortex moves methodically, step by step across it, searching for weaknesses, the roof begins to lift. The windows suddenly combust inward, shattering inside the house. The bricks on the chimney are stripped away, vanishing instantly in the violent funnel. The house begins to rock on its foundations, moving back and forth, and then all at once

All at once

Nothing.

As quickly as it appeared, the violent cloud rises back into the darkened sky and dissipates. The old house has survived yet another of nature's tantrums. It will not be the last.

The lesson? Test your work. Things happen. Sometimes really bad things. Sooner or later, they'll happen to your software. The rain will come, the winds will blow, and the earth will shake. Will your software survive? That depends on how well you built and tested it.

Testing is the most commonly underemphasized step in the development process. Inexperienced programmers are natural optimists. Experienced programmers are a little more cynical . They've written enough code to know how easy it is to let something simple get by you and how embarrassing it is when that something shows up in production code.

Testing is a natural shortcut target. If we can get it right the first time, we don't need to test, right? If we were skilled enough to avoid having bugs in the first place, there'd be no need for testing, right? Wrong. This kind of thinking is based on two grave misconceptions: one, that good programmers don't write buggy code, and two, that it's possible to "get it right the first time" with anything but the simplest of software.

First, no matter how skilled a developer you become, you'll accidentally introduce bugs into the code you write as long as you write code. Martin Fowler says plainly: "I'm still human and I still make mistakes." [2] Until someone figures out how to embed infallible computers in our fabulous-but-flawed brains , we will continue to make small errors in most everything we do. It is part of our pact with nature: In exchange for emotions, abstract thought, and consciousness, we have traded away machinelike precision.

[2] Fowler, Martin. Refactoring: Improving the Design of Existing Code . Reading, MA: Addison-Wesley, 1999. Page 7.

Second, anything but the simplest of applications is impossible to get exactly right the first time through. Things change. User requirements change. Technical requirements change. Project resources change. Your understanding of the business problem you're attempting to solve changes. These elements all impact your software. Kent Beck claims that the problem isn't change itself, because change is inevitable. The problem, he says, " is the inability to cope with change when it comes." [3] Whatever the case, simple human error and the constant state of flux that seems to characterize every complex software development effort combine to virtually ensure that you won't produce perfect software the first time through. So, even if you somehow manage to build a bug-free application with your initial effort, it will still almost certainly require modification. It won't be right the first time around. Count on it.

[3] Beck, Kent. Extreme Programming Explained: Embrace Change . Reading, MA: Addison-Wesley, 2000. Page 28.

Testing is key to project success. It's every bit as important as coding, perhaps even more important, because it provides an opportunity to correct problems not only in a program's code, but also in its analysis and design.

Testing provides a means of accurately gauging progress. The completeness of the project isn't based merely on how much work you've done, but on how well you've done it. In his book Extreme Programming Explained , Kent Beck goes so far as to say: " until the tests run, you're not done. Once they all run, you're done." [4]

[4] Ibid. Page 33.

Testing should be automated when possible. What do I mean by this? Testing should be as easy as compiling your application. You should be able to click a button or type a simple command to test your app completely. How? By using automated testing tools, by building a testing harness into your application, and by having the testing mechanism check its own results. See the following sections for more info .

for RuBoard


The Guru[ap]s Guide to SQL Server[tm] Stored Procedures, XML, and HTML
The Guru[ap]s Guide to SQL Server[tm] Stored Procedures, XML, and HTML
ISBN: 201700468
EAN: N/A
Year: 2005
Pages: 223

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net