Friday, August 13, 2010

Stuff you learn about when it breaks

Somewhere in my basement I have a copy of Winograd and Flores' Understanding Computers and Cognition, required reading in some late-1990'es HCI course. Just about the only thing I remember from that book is this quote: "The word processor exists as a collection of hardware or programs only when it breaks down." This is in the sense that you don't think about a tool which doesn't get in the way, and only when it fails (or is missing), you notice it and start to analyse it.

Fast forward some 13 years, a few days ago, I finally got around to writing some better UI tests of WTP's "XPath View", using SWTBot as the weapon of choice. Having read the SWTBot getting started docs and some useful blog posts, writing my tests were soon well underway, using the fluent API provided. It is fun to watch the application speeding along like time-lapse film, like magic.
Everything went fine until I wrote code to switch the XPath view's active process from XPath1.0 to XPath2.0, using the view's menu. The API was pretty easy to figure out, but the view menu finder just didn't pick up the menu item I wanted.

There's my breakdown: Why?
Well, it turns out that unlike regular menus and context menus, view menus are collected in a different fashion by SWTBot, by examining the contributions rather than enumerating the SWT objects themselves. Some corners cases are not covered. Not a big deal, really, but it made me look at the source for SWTBot, which is quite a pleasant sight. Now it exists as real code in my mind, as does the Eclipse command framework implementation. And I also now "get" the Hamcrest Matcher framework which I've previously thought to be horribly over-engineered.
With my new knowledge, I can even extend SWTBot. Nice.

Then fast forward two more days, while this blog post was sitting half-finished in my browser, Saturday evening, after historic amounts of rain in the area, my basement was flooded: The sewer couldn't contain the rain, and the system broke down and came very much into existence, as sewage water gushed up from the drains and toilet and my otherwise dry basement became a 20cm deep paddling pool, allover. Getting the water out took hours; getting the smell out will take days, maybe weeks.

Like software, sewage is something most people would rather not have to deal with. It's supposed to be "invisible magic", but in reality it is messy and complicated, and when it doesn't work, it makes for a shitty situation -- yet our society very much depends on it.
The really strange part is the book: I haven't found it yet, not in the "dry" pile, the "slightly damp but fine" pile, the "soggy yet perhaps readable" pile, or the "discard" pile. I know that book must be down there somewhere, and when I find it, it's going back into my reading queue right away.

P.S: My flooded basement was a picnic compared to the flood in Pakistan. Consider donating to your favorite charity!

No comments: