Driving and Test-driven programming--Where do we stand?

来源:互联网 发布:淘宝箱 编辑:程序博客网 时间:2024/06/06 07:48

I live in a very flat part of the world. Many of the roads are straight and level--you can almost imagine you could point a car down the road, take your hands off the steering wheel, and the car would go exactly where you pointed it. You can't, of course. Even on Illinois roads, driving is a matter of frequent, tiny corrections to you course. And even on these roads, the novice driver wil lurch wildly from one overcorrection to its opposite.

Programming, for many, is like forever being a novice driver: periods of calm where things go invisibly wrong, followed by bursts of frantic panic and correction. I sometimes think that the only people who become programmers are ones who can tolerate that enviroment and that observing programmers struggle is the reason so many other people think programming is too hard for them.

However, programming can be much more like driving a car: steady, small corrections on the way to the goal. Test-driven programming is a good way to do that. It makes code more accessible.