Trying to Juggle Only One Thing at a Time

I am the primary maintainer of Conductor.  As such I am responsible for implementing new features, squashing bugs, tuning it’s overall performance, and improving the code’s maintainability.  It is very easy for these tasks to blend.

As I was working on adding a new feature to Conductor’s custom database, I found areas in the code that could be reworked for better clarity.  In rather short order I went from writing new code to adjusting existing code.   And I quickly grew to regret it.

The problem was that I had crossed from one task into another. The code base, in it’s current state, was juggling two incomplete concepts.

I am not a juggler.  However, I can quite easily juggle one ball.  I can even, to a lesser extent, juggle two balls.  The third ball is beyond me.  In fact, I find that juggling two balls is more than twice as difficult as juggling one ball.

So my changes were now unnecessarily complicated.  Not insurmountably so, but inconveniently so.  Instead of each task taking 10 minutes a piece, together they would take 30 minutes to resolve.

Programming is the art of transforming thought into instruction.  It is therefore easy to drift along a stream of consciousness and find the changes in your code to be unduly complicated.

Red, Green, Commit, Refactor

If I can follow the above 4 words of advice, I can reduce the potential for over-complications.

Red: When working on resolving the problem, I need to come up with the test (ideally automated) that will fail until the problem is resolved.

Green: Write the code to resolve the problem and verify the problem is resolved.

Commit: Update the code repository with the changes.

Refactor: Now go in and clean things up so it is either more legible or understandable.

More on Red-Green-Refactor

Comments are closed.