4 ms·
The main value in TDD is not when you write the initial implementation. Sure, it can help, but most devs are competent enough to implement a function/class/what
by cgrealy 5y ago
The main value in TDD is not when you write the initial implementation. Sure, it can help, but most devs are competent enough to implement a function/class/whatever and have it do what the programmer thinks it will do.
The value from TDD is documenting those assumptions.
"The db will always be connected before this class is used",
"This function assumes the user is authenticated" and so on.
Then in 6 months, a year or even 5, when you or someone else comes back to this code, you can be reasonably certain changes to it will break tests, because the tests tell you how the REST of the codebase is using this.
Of course, that assumes a decent shelf life for the code. If you can be reasonably certain you're going to handover this and never touch it again, don't bother with the tests. And delete the repo while you're at it.... (not comfortable with that, are we? :D )