My claim is this : Sooner or later, every software development effort slips into same kind of workflow :
- Define a test case.
- Change or extend implementation so that above test case passes.
- Execute the test case. If it passes go to 1. If it fails, go to 2.
This workflow is so far only one for which we know produces software that fits the specification. Only difference is how this workflow is implemented. For example, as software development process, the steps can be:
- Create a specification.
- Implement an application according to specification.
- Have testers make sure the implementation is according to specification. If this fails, return to step 2.
This process works as long as no corners are cut. Which means defining the specification with high levels of detail and having army of testers, so whole specification can be validated. But much worse is situation when the whole workflow is non-conscious, as presented by Josh in previous post :
- Test case is kept in programmer's memory as steps to run the use case.
- Change or add code to fix current use case.
- Run the steps as defined in 1.
It should be obvious why this is so bad, but that is not a point of this post. The point is that no other workflow exists that would give software developer ability to create software that works according to specification. Or at least I don't know about any.
That is why I pose a question, primarily to those that claim TDD doesn't work : Does any other workflow exist, that cannot be reduced to this one?
There are few options, none are good.
First option is to implement the software properly the first time. I believe this is just a dream and that this is only possible for simplest of use cases. If software gets even little bit more complex, it becomes impossible to create it without executing the test cases during the development.
Second option came from the comments on the previous post : That developer can "feel" when software is correct. And while I agree developer can limit amount of tests that need to be executed by using his experience and intuition while looking at code itself, there is still huge possibility of bias. So while it is possible to come up with new test cases and minimize testing by having good experience, it is not full replacement.
So if we agree that this is the best workflow to follow, it then starts a question: "Which implementation of this workflow is best?" But that is question for another post (with obvious conclusion).