Disclaimer
I just want to take the time here to point out that your argument essentially boils down to the distinction between waterfall (design before implementation before testing) and agile (test-driven, quick and dirty, continual refactoring).
Neither of these is universally superior to the other. Each approach has its own drawbacks. This answer is not trying to tell you that you have to follow TDD principles, it's only trying to highlight the benefits of doing so, since your question seems to be rooted in not understanding the benefits of the TDD way of doing things.
It didn't say to never improve your code
Time wastage & how to avoid it
Direct feedback to your questions
No, but it does shake up the fundamental approach to software development. When you first encounter something that is radically different from the ground up, it's very hard to know whether this new thing is wrong or whether you just don't get it (yet).
Based on the prevalence of TDD in the field of software engineering, it's safe to say that it does work, so the logical consequence is that you're not quite understanding its principles (yet).
If you cling to the (non-TDD) fundamentals you know and love and don't want to reconsider them, then you're not in the right mindset to accept TDD as a different-but-equally-valid methodology.
Because that software engineer minimizes time wastage while maintainingalso not lowering code quality.
By implementing a first (temporary, working) solution, they more concretely define the domain for which they will then design an appropriate second (cleaner, more abstracted) solution), thus making sure they don't overengineerover-engineer things or regress constantly, both of which waste time on things that are not necessary or can be avoided.
Red stage test cases are there forbeneficial in two thingsways:
- They helpforce you to define an interface without being distracted byusing your knowledge of the implementation of that interfacedetails (since the implementation doesn't exist yet).
- You set up a testing suite that will then support your implementation and refactoring stages, which means you get more direct and accurate feedback about the consequences of any changes you make. Think of it like having a personal code reviewer who's constantly looking over your shoulder and immediately pointing out any mistakes you make, instead of telling you a week later. Sort of like what your IDE already does for you (the red squiggles), but using a bigger picture.