Do the Simplest Thing First

To help me get over my writers block I've decided to do a series of mini-blogs on programming topics. The first is called: Do the simplest thing that works.

Once I know what I want to make happen there is a paralyzing spiral that can hijack all progress. Planning out layers of abstraction, perfectly handling every edge case, etc. Most of the time what I really need is to implement the what in the simplest way possible and verify I have it correct.

One way to look at programming is as an exploration of the problem space and each step of the implementation better defines the problem being solved. Sometimes I need to just take the next step and find out if I was right.

One example is logging. I could start every project by pulling in a logging library and setting it up to log to stdout and a file and, etc, etc.

But if logging isn't core to the problem I'm trying to solve that might be wasted time. At the very least it can soak up momentum.

So I usually start with boring old print statements or whatever the language equivalent is. In a recent c++ project I needed something a little more robust and threw together a handful of macros to format an error message for std::cout. Will that be the final logging solution for that project? Almost certainly not. But I wasn't ready to dedicate time (and momentum) to finding a good logging library and learning it.

If I'd been writing python I might have jumped straight to integrating the logging standard lib because I'm pretty familiar with it already. But maybe not. When you are still exploring the problem space I don't think it's terribly helpful to spend a lot of time on infrastructure that doesn't further that exploration.

What are you thoughts? Do you have an example of "Do the simplest thing that works?" Or maybe a counter example?