Knowing Your Code

I’ve often been criticized for “reinventing the wheel” in my programming — creating my own programming components instead of using pre-written ones. Part of that was a deep-seated distrust of the competency of other programmers (something I learned early), and part of it was the fun of doing it myself. But reading some of the programming questions on Stack Overflow, I realized that there’s a third and even better reason: if I don’t thoroughly understand the code, I can’t track down problems with it.

I don’t know if all decent programmers share this trait, but I know my code very well. So well that I can track down most bugs in it in my head, without even being near a computer, so long as the code was typed in correctly. You can’t do that when you’re using code that someone else designed and wrote, not unless you already understand the solution so well that you can correctly guess what the original programmer did in almost all cases — which, for me, pretty much means I had to write one myself anyway.

So I’ll continue reinventing wheels whenever it makes sense to do so. It may take me a little longer to finish a program, but I’ll have a lot more confidence in the result, and I’ll be able to predict exactly what it will do under pretty much any circumstance.