We talk about “bugs” in software as if they were caused by some unavoidable, blood-thirsty third-party that invades our pristine code, much as ants might attack a sweet picnic basket or mosquitoes an exposed neck.
But while bugs seems to be both unavoidable and blood-thirsty, they of course aren’t coming from anywhere but our own hands. We make them, and then they sit there, hidden in plain sight, right in front of us. Waiting for just the right moment (the demo in front of the vice-president?) to spring out from hiding and mock our calm expertise.
Do you know why we advocate the practices that we do in modern programming? Sometimes the reasons get lost in the drive to full buzzword-compliance; or perhaps you’re doing a programming practice because everyone else is doing it, or because some author recommended it. So let’s talk about why.
If you can cut down the number of places for bugs to hide, then when you do create a bug, you’ll find out about it right away. Not a month or six from now, once the app has been approved or the startup has launched or whatever. Get rid of the hiding places and you can fix the bugs now, while they remain small (bugs that hide, of course, snack on leftover code and grow stronger and larger with each passing day).
So here are but a handful of popular practices that help eliminate hiding places:
Unit tests
Why do a unit test at all? For only one really compelling reason: to prove that the code you just wrote does what you think it does. The tests pass, and know you know with some certainty what the code is really doing. That still might not be the right thing for it to do, but at least you’ve removed one breeding area for bugs.
End-to-end Tracer Bullet Development
The first iteration of a system should go from end-to-end, even if it’s as simple as “Hello, World!” That is to say, you’ve got all the major parts hooked up as it will be in the final system: from database through browser via some middleware, that sort of thing. No single part has to do much at all, but it needs to be there—to shine a light and remove a dark hole where bugs can hide.
Buddy up to Prevent Bug-Blindness
We are all particularly blind to the bugs we create, but fortunately a second pair of eyes (someone else’s, preferably) can usually spot them when we can’t. So practices such as Pair-Programming, or Code Reviews (be they nice and informal or excruciatingly formal) can really help identify our own blind spots. Have someone else check all your code before you check it in.
Frequent Delivery / Demo
And of course, nothing brings bugs out into the spotlight as effectively as an audience. Bugs just love the spotlight in front of a live audience, it’s a great chance for them to show off. And get caught. So give them the opportunity often: deliver working software every week or two, and demonstrate it to someone who cares. The bugs can’t resist the urge to show off, and then you’ve got them nailed.
Share Your Status
You need to know what the rest of your team is working on. You need to know when they’re stuck, or when a subtle change in direction or design starts to gain traction. By the same token, you want your buddies to know when you’re stuck or have come up with a new direction. The classic Stand Up Meeting from Scrum is a great way to do this: it’s a quick meeting, you do not go into problem-solving mode, you simply answer three questions:
- What did I accomplish yesterday? That is, what concrete thing works now that didn’t work or exist before? Never answer with an abstract form of “I’m working on xyzzy.” That’s a dark hiding place. Be concrete.
- What am I going to accomplish today? What’s your goal to get working today? Same criteria apply as to the first question.
- What is in my way? This can be a big one. Do you need help? More resources? An answer from a reluctant source? The list of these blockers is your manager’s TODO list.
There are all sorts of other ways to reduce hiding places for bugs: information radiators, continuous build machines, code-level techniques including refactoring, and many others. None of these techniques will stop you from enbugging in the first place, but they will help you find them and squash them more quickly.
Code can be a dangerous place. Keep it well lit, and do go in there alone ;)












Resistance is Natural
Resistance is Natural.
Resistance is the enemy. You’ve probably encountered resistance in at least popular form: we call it procrastination. But envision resistance as a much more powerful, more universal and pervasive force. Something like a meta-gravity, weighing down any of your significant endeavors.
That’s how writer Steven Pressfield views it in his book, The War of Art. Resistance as a mindless, destructive force, acting against all your better interests.
Whether it’s a creative endeavor in some art, an entrepreneurial venture or enterprise, diet or health initiative, education or project of any kind, resistance is there to be met as an opposite and equal force.
Resistance is sneaky and subtle. Procrastination is an obvious and easy manifestation, but that doesn’t make it any less potent. Some procrastination is easy to spot, especially if it involves cat memes or Reddit. But what about more subtle forms of procrastination, such as hiding behind estimates, or avoiding pair-programming, or not writing unit tests, waiting until you know before you try, or the pinnacle of group procrastination: the big meeting?
Then there’s the subtle expressions of resistance: some buried, niggling fear. Fear of failure, however small or large. Fear of being exposed as a fraud. Fear of loss. The perceived lack of support from your boss, or folks who work for you, your family, spouse, kids, and the rest of the infinitely uncaring universe. The unforeseen setbacks that send a stab of panic through your viscera.
The amateur takes these all personally, and resistance wins as you waste kilowatts of psychic energy trying to relive, rehash, revisit and reframe these events. The professional sits down, shuts up, and moves the ball forward.
I hate sports metaphors in general, but in this case it’s particularly apt. If the action you’re taking right now isn’t “moving the ball forward” (i.e., not advancing you to your goal), then resistance has won this round. It’s all about moving the ball forward, even if it’s just moving a few inches for now.
Think about that a moment. If your current activity, whatever it is, is not advancing you toward your goal, then it’s pulling you away from it. And no, it’s not letting you idle or stand still. If you’re standing still, your goal is still is motion—away from you. You’re losing ground.
King Leonidas of Sparta once said that the supreme virtue was “contempt for death.” Pressfield equates that in our modern times with “contempt for failure.” No matter what, move the ball forward. Ship the software. Write the chapter. Paint the picture, shoot the scene, post it, commit the code, whatever. Get it out there. Now.
And tomorrow the battle begins anew. New adversaries, new tactics. Resistance is clever, and will go for your soft spots. But resistance’s fatal flaw is its single-minded goal of stopping you from doing what you must. There’s one sure fire to win against resistance in all it’s forms:
Do it anyway.
Posted on February 28, 2013 in SocialCommentary, SoftwareDevelopment, Wetware, Writing | Permalink | Comments (1)