Michael Kovacs' photos More of Michael Kovacs' photos
Recommend Me Cable Car Software logo

Friday, October 30, 2009

Tivo your code

Lately I've been working on a project with some other developers and we were having discussions about development methodology choices and the role of testing in software development. I know that this topic has been covered to death but I personally always find it fun and rewarding to come up with new analogies for thinking about software, or anything for that matter, that helps educate and clarify the meaning or impact of a given concept, behavior, or pattern.

So while I'm not going to step back to the question of "What is meaning of life?", I am going to pose a high level question of "What is the process of writing software?" What is it you are actually doing when you're typing away in that text editor?

You're telling a story. A story of a software's journey. You're giving that story a plot line and characters and ideally it's going to go somewhere interesting. Not all software does, and there's a lot of reruns out there. Now you might be creating a really simple children's story like "The Little Iterator That Could" or something more involved like "The Passion of the Load Balancer: Timeouts Edition"

Whatever you're writing, every time you do so you're creating or building on an existing story. Your first "audience" for that story is your computer. Now computers are really patient but at the same time pretty intolerant listeners. They will sit there and listen to your story, no matter how good or bad, whenever you want. Like your mom they have an unending supply of patience and can endure the most boring of stories because, well, they have to. On the other hand just like many moms they're very active listeners and will critique your story until they understand every last detail, and it can get annoying because sometimes you just wish they'd implicitly know what you're trying to tell in your story. You can find yourself saying things like: "No, no, no... it doesn't go to 'find_the_dud', come on you know I meant 'find_the_dude'" So yeah it can be a bit annoying, but they really help keep your story straight for when you're ready to move on to the big time.

Speaking of the big time... it looks like your story was just optioned for a spot in the latest upcoming code repository! Oh joy! You can't wait to share your entire story with the world. You can't wait for the first episode to air with your new audience members, people. Your mom, err computer, loved the story and was able to understand it, surely your code is destined to be the next "Seinfeld" of the software world.

So it's opening night, your new episode is about to air, but then something strange happens. You continue telling your story and your audience is confused. They're not following your plot. They don't understand who the characters are, the roles they play, and generally what's going on and where things are going. Hmm... this is a problem. How is anyone going to love and adore your story if they aren't able to follow what's going on? And yeah, they're all coming into your story after it's begun. It might be episode #3 in your series of stories, or perhaps this is your Treehouse of Terror XX, the 20th installment in an entire series of stories.

So how the heck are you going to get your audience up to speed on your plot and characters so that they can follow your amazing story from here on out? And how are you going to ensure that they can always keep up to date on your series if they can't be there to watch/listen as you're creating this poetic genius?

You do what we all do when there's something we want to watch/follow but don't have time to do so "live", you Tivo it. Ahh yes Tivo. No longer do we don't have to have the show's writers sitting next to us on our couch, or more commonly, a friend explaining to us what happened on last week's episode of "As the Kernel Dumps". We can go get caught up at our leisure by simply watching the old episode on our trusty Tivo, and we'll be up to date with the latest plot when a new episode airs. Heck, we could even stand in for the writers and create our own next episodes of the show if we wanted to or had to in the event of a strike.

Fast forward a bit and now based on your smashing success of your last project you've just landed a role as a writer for a hot new Abobe Flex sitcom involving some charts, data, and other things that are sure to be instant hilarity, I mean what's not funny about charts and data? Hmm, but you still have to crank out new episodes of your other ongoing series. Guess you'll have to find some other writers to bring onboard to help with that. Hmm, luckily you've been Tivoing all your episodes so that this new writer can go back and watch all the old episodes to get up to speed and be able to create meaningful new stories that add to the existing plotline in a meaningful way. Oh and Tivoing these stories allows them to serve as a "sanity check" or "regression check" for any new plot lines this new writer comes up with. It's easy to go back and see if what they're coming up with fits within the historical boundaries of the series and if not fix the story accordingly.

Unfortunately not everyone out there has seen the light with regards to Tivoing their code. Throngs of software stories are out there being spoken into the ether with nary a chance at them truly being understood. Unless you were there from the firing of the opening brace or shortly thereafter you're not likely to understand what the heck is going on without some help from someone else that's been listening to the story or by talking to the authors themselves. The problem is that talking to the authors or even others in attendance doesn't really scale so well and it's kind of annoying to have to do for all parties. You as the story creator become the bottleneck. Imagine if every author out there had to tell their novels in person. We wouldn't be much further along than Shakespeare right now.

Of course if you haven't figured it out by now I'm talking of course about writing tests for your code and some of the advantages of doing so and the drawbacks of not. Without them you're delivering half a script as to what story the software is trying to tell. Tivoing your code is always a great idea, even if you're the only one that's ever going to be "listening" to these software stories. I promise you that in 6 months from now you'll come back to your series and you'll be plenty grateful that you have those old episodes Tivo'd to help you advance that storyline.

The world is waiting to hear your great stories! Now if you'll excuse me I have to go see "what's playing" in my git repository!

This page is powered by Blogger. Isn't yours?