Whoa! Code without a test? Can you do that?
This is a strange little digression, on two points.
First, the error messages for the equality tests are something that should have been observed when the equality tests were created during RED. That would have been the obvious time to notice the messages and make improvements to them. Perhaps addressing the issue then would have made the earlier chapter more confusing.
Second, the change to the output message doesn't actually clarify the problem - Kent calls attention to this in the text, of course, but I'm amused that the extra work thrown in at this point made the failure harder to recognize, rather than easier.
Kent decides to back out the change and start over: here, he calls it the conservative approach. Fifteen years later, he'll introduce test && commit || revert -- a way of committing to the conservative approach.
With the tests you can decide whether an experiment would answer the question faster. Sometimes you should just ask the computer.
I like the experiment language quite a bit.
I'm beginning to feel that the main lesson up to this point is something along the lines of: be flexible until you know what you are doing.
No comments:
Post a Comment