This post is not about your boss growling at you. Another title could have been “whisper-driven development”. It’s about your code whispering its status to you.
To learn this newfangled kind of development, whip out an Apple computer, and start a project using Test-Driven Development. We use Rails, but you can use any platform you like. (You can use any computer you like, so long as you can find and configure a Growl-style program for it. See below.)
In Rails, use ZenTest’s autotest command, or write your own batch file, that triggers a test run each time you save any source files. I have one here; it’s a little more “generic” than ZenTest’s version. “Generic” is a programming euphemism for “scrappy - a fixer-upper”.
Now edit your tests and code, and each time you save your files, that batch file detects the new file times, and it calls the command you passed to it. The command runs all your tests, and prints their results to your console.
If you don’t want to even look at the test results, that’s where you use the Growl command to whisper your test results. Get Growl for MacOSX, and configure it like this:
- Start at Login
- Display Style: Speech
- Display Options -> Speech: Whisper
- Network -> Listen for incoming notifications
We develop on Rails from a shared account on a fast, remote, Linux server. So at the end of our shell script, we have this logic:
if anyFileChanged()
got = system(command)
effect = got ? 'yeah' : 'no'
system("growl -H 10.10.10.193 -m #{effect}")
end
And that’s all there is to it. The
command part is your command to run all your
tests. Maybe “rake test:recent“, for
Rails.
If the command succeeds, it returns
EXIT_SUCCESS to its caller, which is zero (0). All
test scripts should do that. So when the script detects that,
it sends a command to whisper “yeah”.
Using Whisper Driven Development, you type a little, you hit a button to save all files (we configured <F5>), and you keep typing. When you hear “yeah”, you know your last save contained good code - according to your tests! Any edits you make since then are questionable. So, like good TDD zealots, you start hitting the test button more often.
When you are stuck on a bug, you start to hear “no” a lot. (If you are stuck on a bug but you hear “yeah”, you need to upgrade your tests!)
Frequently hearing “no” is very annoying, even in a whisper. This is why we don’t get sophomoric with the Growl settings. We don’t set the voice to Hysterical, or Bubbles, or Deranged, or even Good News or Bad News. My spouse has one of those old cars that says “a door is ajar” when you try to get out, and that kind of thing wears thin very soon. Computers do not really have personalities, and pretending they do just causes friction. Has anyone seen Microsoft Office’s Clippit character around recently?
This is indeed why we didn’t go with “yes”. “Yeah” is more than laconic; it doesn’t have the high-pitched overtones and sense of urgency of the S sylable.
Just a smooth, subtle whisper, “yeah” or “no”, to keep your TDD humming.
