Re:The evil unit test.
by ams6110 on Monday January 30, 2012 @12:46PM
(#3529746)
I don't understand what you are saying. How can you start coding if you don't even know what you intend to do or what your expected inputs and outputs are? What are you exploring, and how do you know when you've found what you're looking for?
[ Parent
| on HN ]
Another simple example from my work of the moment: my goal is to import points from a file (that I'm assured does have points) using a 3rd party file import library. I don't know in advance how the 3rd party library imports points, so the best test I could possibly write ahead of time is a fairly high-level integration test, "Did we manage to import a point?"
All my actual programming work here consists of adding printfs at strategic points to tease out exactly where I should be looking for the point data. Unit tests are completely useless for this process.
Come to think of it, even once I've got it figured out, it's very hard to see how to usefully use unit tests here...
As an example of exploratory development that's very difficult to do test-first, I've been doing a lot of image processing work lately with the objective of improving the legibility of photographs containing text. Trying to find a way to automatically test the output before putting together a solution is a unique problem unto itself, since any given set of input parameters could potentially "solve" the problem for some images but not others.
Sometimes you have to explore the problem domain and available tools for a while before you figure out where you want to go and how to get there. It's sort of like an iterative prototyping methodology.
http://paulgraham.com/arc0.html
I don't use Arc (or any kind of Lisp) but I understand what Paul Graham was trying to achieve.