Tuesday, October 25, 2011

Write it down

Recently I was thinking through a programming problem in my free time, for several days. (Authorization of purchases and content delivery.) After a week passed, I knew I had considered all the different cases, but couldn't get the whole flow pictured in my head. At each step of the authorization process, different issues come up where either a legit customer may lose data, or a pirate gains unauthorized access to content.

I was reluctant to write things down on paper (or electronically), since I felt I needed many changes to get it right. Writing it down would only add more overhead as I changed the design around. Unsurprisingly, I have a similar sentiment towards test-driven development, where in many cases the project being built out is too uncertain in requirements, and new features may be desirable later on, such that writing tests up front only adds overhead later on. Unit testing in general, though, is highly desirable.

After the week passed, I was at the point where I wanted to write down the design, so I could pick at it without spinning my wheels thinking about the same scenarios over and over. As you've probably guessed, writing it down helped me immediately see a couple problem spots and get the design down from start to finish. It also helped to have visual separation between the components of the process. In my head I would jump back and forth between components, like initial purchase versus restoring purchase history, trying to think "where can I reuse this security token and when do I need to generate a new one?" and things like that. Writing it down, even in just simple numbered lists, helped me split up concerns and stop wasting mental energy juggling different pieces.

The message of this post is hopefully obvious to most people, and even for me it is something I've learned and relearned many times over the years. It's just times like these, when my pride creeps up on me and makes me believe I can handle thinking all the way through moderately complex designs in my head, that I disregard an obviously useful methodology.

No comments:

Post a Comment