Unit-Testing the Brain
I recently bought The Reasoned Schemer by Daniel Friedman, et al, being a big fan of The Little Schemer and The Seasoned Schemer (A Little Java, A Few Patterns didn't grab me in the same way).
The Reasoned Schemer teaches logical programming in a functional programming paradigm. Of course, it's written in the same question / answer style as the other books—the book asks you a question that you may or may not know the answer to and then gives you the answer. It then asks another question and gives the answer and so on. There's no other content than these question / answer pairs other than a handful of "laws" and "commandments".
The questions cover a range of cases to make sure you understand the subtleties and edge-cases. You have to mold your mind so that it gets the right answer to one question and then refine your thinking further if you can't then handle the question that follows. Eventually, the questions have handled enough cases that you really grok what's going on.
It occurs to me that this style is basically a set of Unit Tests for the Brain.
As a really simple example, here are the first three pairs from chapter 7 which define what a 'bit' is in the context of the rest of the chapter:
- Is 0 a bit?
- Yes.
- Is 1 a bit?
- Yes.
- Is 2 a bit?
- No. A bit is either a 0 or a 1.
That's just a unit test for your brain's concept of what a bit is. It's Test-Driven (Brain) Development.
Comments (5)
James Tauber on May 6, 2006:
For a better example, go to
http://www.amazon.com/gp/reader/0262560992/
and look at the first couple of pages of the first chapter.
Ian Bicking on May 7, 2006:
No comment; just seemed wrong to leave that math problem unanswered after reading the post. 77+9=86!
Dave on May 7, 2006:
music (and cook-) books are often arranged in this fashion as well (albeit much less formally). Rather than explicitly stating a theory, they present a bunch of examples, both fully worked and partial, and expect the reader to implicitly internalize the relevant practice.
Dave on May 7, 2006:
PS. shouldn't the spamguard for this entry be "Is 2 a bit"?
Last Modified: May 6, 2006
Author: James Tauber
Tim on May 6, 2006:
Could you give a less trivial example? In the given example the Q/A doesn't appear to add much to the statement: 'A bit is either a 0 or a 1.'