Wednesday, February 28, 2007

When is "the right way" too much?

It feels good when you know stuff. And knowing "stuff" lets you get things done.

Case in point: the manager of the group I've been lent to needs some metrics for the performance of the app his group has care-and-feeding responsibilities for. The metrics are available on an existing series of web pages...formatted in a nice table.

Unfortunately, said format does not lend itself to data analysis. And he (the manager) as an old sql slinger wants it in a format he can analyze. (preferably excel...of course)

As a proof-of-concept I whipped up a batch script using wget and sed to determine if it was possible. (and work out the regex kinks) This took about 1.5 hours.

(I was happy...given that I think I've used sed maybe once before. The thorniest part was figuring out the differences in command line syntax/quoting between all the sed tutorials and the gnu-for-windows version of sed..)

After verifying the data was useful, I wrapped the functionality (using C#'s native regex capability) into a nice little windows form app. Two hours later, I had an excel spreadsheet with snazzy pivot table. Data source when "updated" looks in the default location that the forms app dumps the csv. Time, about 2 hours.

This was a quick one off app that'll be used by one person, 1-2x/month, but I did get to thinking what I would do to make it "more robust". To wit:

csv file
overwrites existing (no option to overwrite/append/rename/etc)
filesystem space check (is there enough space?)
filesystem directory check (exception if specified directory doesn't exist)

metrics http source
no specification of server or source page (if it changes, the path'll probably change)
somewhat brittle regex I'm guessing
no handling of "if the server goes away" (.net exception)

architecture
downloads whole whack of data each and every time (but only takes about 30 sec...seemed a good tradeoff)

But...all those things considered...I wouldn't change it given my requirements. The user was very happy. It's something that's used infrequently. It's unobtrusive and quick.

Does it make the user happy? Yes. Does the solution raise them to a higher plane of consciousness? No. I think it's probably more along the lines of "hey, I couldn't get this data before. I can now do it in 30 seconds." The solution got out of the way of what the guy wanted to do - namely, analyze performance metrics.

I'm happy. He's happy.

Life is good.

0 comments: