Tuesday, June 2, 2009

Symmetry and Simplicity on a Monday

I just watched an Ira Glass video about taste and sticking with your work, and practicing. Of course, any attempt to compare myself to Glass will end in disappointment for me.

I work with a great programmer. He holds more of the system in his head than I do, and is more comfy with the environment. We were sketching different ways to go forward, and before lunch he showed me a direction I really liked. It harmonized ideas from various conversations, and is well-timed.

I did feel something was a little off, but I was confused about what it was. I blame it on mondays, especially since I was busy with many things this weekend (departing friends, graduation open house, etc). I got lost between C# syntax and C or Python at one time, and only frustrated myself (and surely my gracious partner too).

Finally I realized that I was being confused over an asymmetry I had noticed earlier. I couldn't even phrase the concern (well, without being intense) other than it was asymmetrical. That sounded about as OCD as possible. Eventually I realized that I was confusing two levels of wrapping/unwrapping and I think we had them confused in code too.

The problem in a nutshell was that we had some doubly-wrapped data in a formatted packet and didn't have crisp boundaries established. Without the code being clearly segregated, I was not able to keep track of which wrapper we were in, and it seemed we were mixing level 1 wrapping with level 2 wrapping (to ill effect). I realized I was confused, and I realized that the code looked confused too, and we refactored it into a more sane state.

Right now, it looks good. It makes sense and we might be able to continue development by extending it cleanly to many of the types we work with. It has symmetry and clarity, and even a little bulletproofing tossed in.

I was hazy (perhaps from sleeping poorly) and could not tell that I was munging two concepts in my head. As soon as I realized the problem, I became lucid and energized, instead of being frustrated and inarticulate. Understanding gives me energy to work, confusion sucks the oxygen from my air. The code was suddenly easy to clarify and test.

Perhaps I need to practice what I have read about thinking clearly. That would be a good lesson to take with me.

What I am likely to remember, though, was that my "taste" was dead on even when our work was a little off. This made Ira Glass' words ring through to me again. You can know what's right, and can know that "this isn't it" even when you're muddling through on a (mentally) cloudy Monday.

Glass' observation seems to be universal (enough) if it applies to both him and mere me.

No comments:

Post a Comment