Human Stack Overflow

It’s interesting to every now and then stop what you’re doing and take a look at (and some time to think about) how you do things. The human brain is incredibly good at some things, and incredibly bad at others, so it makes sense trying to maximize the amount of time you spend doing things in ways that the brain is good at.

I find that I’m good at executing algorithms on a low level, where each component is easy to execute. For instance, doing the laundry would easily be described as an algorithm of sort laundry, put clothes in machines,  wait until done, move clothes to dryer, wait until done and finally sort clean clothes. All easy steps leading to an easy total procedure. Not fun, but easy.

stackHowever, when steps become complicated I soon hit my own internal stack limit and overflow it. For instance, today I started out investigating how to do something new with our pathfinding middleware. I read the docs, and went to take a look at the examples. The examples gave me an error and crashed, so I had to look up why. Turned out I needed a new license file compiled into the examples. I downloaded the license file from the support site, and tried to compile the examples. The compiler gave me a DirectX include error, so I went to install the DX SDK. After finding the setup package, the installer told me I needed to reboot.

It seems like a sequential set of problems to solve, but actually it’s a recursive process. I was rebooting to solve a compiler error to fix a license problem to run an example to learn more about how to implement a feature. That’s quite a stack depth, and in some cases the stack can simply overflow. When this happens, you solve some problems you’re working on, but then somewhere along the line realize that you forgot whatever it was that caused you to start solving that last problem.

This used to happen to me when I was writing a game engine for the Velox concept game. My colleague at the time even wrote a couple of small scripts to be able to push and pop things off a stack on his workspace in order to get around the problem.

You don’t even need a hard programming problem for it to occur. Have you ever found yourself starting out cleaning the apartment, but then ending up sorting through all your old papers you found in a stack somewhere? In the end, you’ve missed the target of cleaning the apartment, because you built up too deep a the stack and lost track of the original work item.

This whole thing is also a part of the explanation to why the human brain is so horrendously bad at context switching, and why programmers hate being interrupted and asked to work on something else for a bit. You not only have to put aside what you’re doing right now, but your entire stack of reasons you’re doing it.

My colleague absolutely did the right thing. Explicitly keeping track of your work stack is important, because it lets you easily remind yourself of what you’re doing. It takes a bit getting used to, but definitely increases your productivity in the long run.

2 Comments

  • By Paul Evans, Monday, February 16, 2009 @ 21:56

    I totally understand what you are saying there :-)

  • By repi, Wednesday, February 18, 2009 @ 19:16

    Oh yes, some days it feels like all I do is to fight mental stack overflow.

Other Links to this Post

RSS feed for comments on this post. TrackBack URI

Leave a comment

WordPress Themes