Let's say I have a file that needs to be parsed and validated. Instead of jumping to tests, I want to first think about the objects involved and their messages.
I would then write out the above code.
After I'm satisfied with the objects and their interactions, I would then write a spec for FileObject
or FileValidator#validate
.
I consider this approach a technique above TDD. Before, when I used to jump straight into the specs, it would often result in working code, but bad design. TDD encourages you to think about design, but only in your head (which is obviously not as efficient as writing it out, not to mention the visual feedback).
NOTE: The very first thing I do is create a functional/high-level spec, so this approach only applies on the implementation level (units).