Embrace your bugs

My friend Mike Smith at Hidden Path Entertainment posted this on his blog ( Elecorn ® : The Animated Coder ) a couple days ago:

When I first started programming, a bug was an indication that something was wrong with the code. While this is still true, I now look at bugs a different way. I pretty much take a “glass half full” attitude towards them.

A bug is an opportunity to make your software better. Instead of asking: “How could this happen? Who made this mistake?”, rather say: “What can we do to make our system more robust or safe so this doesn’t happen in the future”. Sometimes it’s a code fix and sometimes a process fix. But either way, finding a bug is an opportunity to improve in some way.

This attitude avoids the “quick and dirty fixes” and reduces occurrences of future bugs of the same type. It lets you focus on other areas that need work resulting in better, more stable software.

So next time you get a bug, try asking yourself “What can I do so that I handle this type of thing better in the future”?

You’ll find that you actually get excited when things break because you’ll see it as an opportunity for improvement rather than evidence of a mistake.

The applications to TA code bug fixing is obviously the same as programming. But what I find much more interesting are the applications to content bugs- and content bugs are as much the domain of the TA as they are of the content artist fixing them. Instead of just fixing a single asset, think of how a system can be built so this doesn’t happen in the future. Think of building in checks and fixes into the pipeline rather than having to hunt things down after the fact. If you have to keep doing the same thing when you fix bugs (say, compiling an animation network once the bug has been found and fixed), make sure this task is as fast and efficient as possible.

Whenever I do this, it is well worth the effort. Instead of having to figure out where a rig broke because a second rig was merged in improperly, catch it before or during the merge. Instead of relying on animators to make animations in place, determine which anims need to be in place and fix them (or ask the animator to fix them via script) automatically. Don’t treat your batch scripts as a bunch of commands, set them up as you would any other code, and they will turn into flexible automation tools instead of hacks. Check materials when you load a file to make sure they are pointing to the proper shaders and files, instead of asking artists to change them manually. Check files when you save them for things you don’t allow, such as spaces in names, capital letters, or extremely large file sizes.

Mike’s words just struck the right chord with me and I thought I’d share them and some of my personal applications of those words here.

Thats a good post rob. We found the same thing here at creative-assembly, when we stopped to look at a bug we often found a bigger underlying issue. The only (small) problem we had, was convincing the younger artists that a bug wasnt neccessary a bad thing, and to come and grab us when a bug did occur, rather than suffer in silence.

I knew there was a reason we connected! I feel the same way and am trying to put all the things you just mentioned into our content pipeline. In fact, I wrote the post about “embracing your bugs” because of some fixes similar to the ones you just mentioned! It was while I was working on the content pipeline tools that I felt the overwhelming urge to write that post.

Thanks Rob!

The caveat i would throw out is definitely spend the time to verify whether it’s a process bug or a code bug and if it’s a process bug FIX THE PROCESS FIRST! I’ve said this a few times and i’ll probably keep saying it until i get drummed off of every forum for repeating it, but often times it’s too easy to say, oh, well, we can fix the code and add this and change this and open this up etc etc until you’ve overengineered yourself into a horribly huge bloated The Blob-equivalent of a codebase, whereas fixing the process may actually mean simpler code and less time spent overall…When your “simple” code fix all of a sudden means writing more code to fix the fix and changing code that is only broken because the “fixed” code broke something well…did you really save any time or effort?

Yes good point Seth, is it a “work around” fix for an underlying problem or is it just a true “bug”

To often people just go with what ever they are handed and don’t ever stop to think beyond the problem and just continue adding on top of a broken system.

Great thread, Rob I am glad you posted it.