Thursday, July 28, 2005

The Non-Spec

I have mentioned before that I really dislike creating a spec for a project. I feel like it slows me down and drains my creative drive. The main reason I see to create a spec in a one person project is to have a plan. That is, to remove the surprises so that you don't end up with those "doh!" moments you get from coding yourself into a corner. I have not often experienced the corner thing, but I do understand the need for a clear plan.

Last week I decided to take a new approach with the spec process. It is my own abbreviated version of a spec that is not really a spec at all, but tackles the problem of having a clear path.

First, let me explain that I like to come up with my own designs of very specialized search trees, hash tables, linked lists, etc tailored to be highly efficient for the task at hand. This is a large part of what drives me and means that typically the applications or services that I write have very complex structures and algorithms. It is the structures I am pointing out here.

In order to quickly lay out my path while keeping as much drive as I could, I decided to start with a new angle to my coding instead. I created all of my memory structures, enumerations, defines and function definitions first. I guess stepping back, you could say that I almost completely flushed out my headers before starting in on the .cpp files.

How well did it work? It seemed to work fantastically. I feel like I have cut my development time in almost half, while only having to go back and correct a structure once.

Why? This is my perception: Normally, I define my structures as needed, and add the required members when I run across them. I think that most of the increased speed has come from the fact that I was not doing so much context switching. That is, I was not leaving my code to go over and add the newly created variable to a appropriate structure every few minutes. Every time I do this, I believe that I lose some time coming back to my code and figuring out where I was. It's not that it takes is much time to figure this out, but simply finding where you left off typing takes more time than if you never left.

Perhaps I'm just a bonehead and the only one that had not considered taking this direction. In any case, I have seen a marked improvement in both speed and organization. I plan on continuing to experiment in this area.

No comments: