My team is interested to apply TDD in our next software project. We have a discussion about how many details should be specified in design specs before the developers start coding.
Some of us propose that we should specify all classes and their relationship in specs before writing code because we have to design all test cases before implementing.
Some of us doubt that this will work practically. In previous projects, we only have a high-level design and let the developer designs the detail classes and methods on their own. The level of the detail in the specs is depending on the complexity of the requirement and experience of the developer. We write the specs only as detailed enough as to make the developer understand what should be done.
I am personally on the latter side of the discussion. I used to try to specify every bit of classes and methods in the specs in my previous projects before. Following are some example of problems that I encountered from doing so.
It takes too much time. To be able to design every classes and methods, an SA will more or less have to wear a developer hat to make sure that every bit of the design can be mapped to the actual code. As a result, the design often does not differ much from the implemented code. We have to work twice on the same thing: for the design and the implementation.
The developer does not have room to think. Writing the design this way sometimes leave only trivial logic for the developer to implement. It is like a fill in the blank kind of exercise for students.
The design often is premature. The design is done on a paper. We don't see how the code is actually running. There are some details we can only know when get our hand on the code. For example, the underlying framework might enforce us to design classes in some way and we don't know this while doing the design. And it is common to refactor some logic in a method to another class when we found appropriate. It's natural that new components can pop up during implementation.
I have tried researching on the Internet and found only this article related to this topic. The article seems to support my belief as it suggests that we don't have to do TDD on the detail classes.
However, the reference is not enough for us to decide. It is possible that designing every classes and methods is the right path and we just don't know the procedure to achieve that.
Do you think we should design every classes and methods in specs before writing code?