2009-11-28

Version Control and Mental Flow

I'd like to admit that I'm at a very difficult time for a programmer: somewhere in the vast wasteland between reading "in 24 hours" books and writing them. I'm the target market for Cookbook style books, for webinars and city-wide sprints. A few years ago I was really happy with myself for really starting to use API documentation or being able to figure out some arcane syntax. Now I blow through the initial structure of my program in an hour, then spend an hour reading dozens of blog posts, a couple mailing list threads from three years ago, and a full wiki; at some point after this hour I can add a few more lines of code.

I'm pretty good at handling threading and at handling TCP sockets, but I get confused when putting them together. I can put together a UI really quickly, then weeks ensuring everything behind it is happening the way I expect them to. I'm at the point I can figure out how to use all manner of development tools: I just need to use them.

In the last few months I've really been pushing myself to use version control consistently and constantly. I've fallen in love with git, and am starting to notice interesting things about how my development process is changing. Right now the most important thing it gives me is a short-term memory. As the concepts I was working with grew in complexity, I began to lose track of what code I was working on. Like oil that thins out as it spreads out on the surface of water, I had a really hard time thinking deeply about a particular topic. My thoughts just got fuzzy and I'd find myself drawing boxes and lines but not achieving better understanding.

Git has helped me change this because my process involves me checking my diff regularly. When I start work each morning it's nice to be able to read my work history and remember the stories I was telling the previous day. After I've made several small changes, checking the diff lets me see each piece together and reassure myself I've done what I intended.

Now, diff comes in many forms and it has always been available to me. But because I've really been solidifying a process for building things, my brain now trusts me with more control. This is the promise of many formal processes: freedom through control. David Allen, when speaking about the joy of the GtD system, likes to remind that [you] won't believe how it feels to have your head clear to respond to what comes up through the day.

Formal methods provide this clarity. Unit testing does this, too. Being able to use a debugger does this. Task tracking does this. Refactoring does this. There are a huge number of intermediate-level skills that I'm encountering that, when mastered and integrated into one process, produces an advanced programmer.

I really like how I'm using Git now, but I'm excited about where I see it going. Once I really figure out how branching works, I look forward to some really excellent ways of keeping my changes straight. Many times while adding a feature, I see a small bug in the code. Before I would simply change it and move on. Now I hesitate, write it down, then continue making my atomic edit and return to the bugfix when I can make that an atomic edit. Perhaps in another year or two I would instead stop working on the feature branch and check out the trunk to make the bugfix then merge it into my feature branch.

My college professors couldn't teach me these things. My team leads in previous jobs couldn't impose this on me. Only I could piece together new behaviors into a better process.

No comments:

Post a Comment