It proved a little tough at first because it was easy to test-drive a solution that didn't require a binary search. Like many practitioners, I like to take a sort of ping-pong pairing approach where I first respond to a test by providing just enough code to get the tests to pass. This helps encourage the tests to have thorough coverage. However, blowing through an array of 100k integers sequentially has no real downside in this isolated case.
I experimented with refactoring the class under test such that the test could query the number of comparisons done to help enforce a binary search, but that felt unnatural exposing the internals of the class. Trying to trick up the scenario such that the test would perform very slowly if it wasn't a binary search felt like it was getting away from the spirit of the kata itself.
After some extra iterations and tinkering I came up with the approach seen here. I think it captures some of the essence of ping-ponging, though admittedly the code knows where it's going ahead of time.
The screen capture and video encoding was done with Microsoft Expression 3 on Windows 7. KeyPosé was used for the keypress overlay. The Expression tools worked well, especially the screen capture tool, though I had a bit of a tough time wringing out a final video that YouTube would grok correctly. There are a few cuts (like the magical appearance of the upTo() implementation) to help fit the video to the audio and clean up some rough edges. Thanks to my employer, Improving Enterprises, for access to the tools. As advertised at the end of the katacast, Improving offers all sorts of agile training and consulting services, click through for more details.
tags: ComputersAndTechnology