News for hackers. Stuff that matters.
Re:An External Replication on the Effects of Test-driven Dev... by hirzel on Wednesday October 19, 2016 @07:17AM (#12742782)
Although, isn't this more true for writing tests at all versus writing tests first or last in the coding process?

In terms of technical debt, does it matter when the tests are written?

Re:An External Replication on the Effects of Test-driven Dev... by noxToken on Wednesday October 19, 2016 @08:26AM (#12743127)
Yes. Some people do not know how to write extensible software. They solve the issue at hand without any regard to big picture, so when something needs to be added (like test) the code needs to be heavily refactored to accommodate the change. As others have stated, this usually(!) isn't a big deal when the project is small with a single contributor. However, writing the tests last without any forethought to what the tests are or how they might be implemented will incur debt when the code needs to be refactored.

Conversely, extensible code can have the tests written before or after without much change to the amount of technical debt. The code is written to adapt to change, so tacking on robust tests wouldn't require too much technical debt.

Note that there is a balance. If you know your goals and have no reasonable expectation for them to change, then making everything extensible is unnecessary overhead. You can also have a mix of abstract functions that are extensible alongside immutable functions that handle something specific. It's all about what works best for your project.

Re:An External Replication on the Effects of Test-driven Dev... by mgkimsal on Wednesday October 19, 2016 @11:25AM (#12744595)
I don't do 100% TDD, but do write code to be testable, and a lot of that mindset and experience came from trying TDD.

Forcing myself to think "how would this be tested?" helped, but doing some of the tests first got me in that frame of mind.

And by practicing that, you're writing code that - by definition - is reusable - you're using it in the tests, and in your production code. The 'reuse' thing doesn't have to mean 'reuse on 8 other projects' (a common rebuttal I've heard). Reusing the functionality in another part of your project 3 months from now is reuse too.

Re:An External Replication on the Effects of Test-driven Dev... by itsdrewmiller on Wednesday October 19, 2016 @12:49PM (#12745390)
If true, wouldn't this be detectable in academic studies? It's easy to write untestable code for small problems, too.
Re:An External Replication on the Effects of Test-driven Dev... by awjr on Wednesday October 19, 2016 @09:15AM (#12743447)
Writing well designed functions that do one thing enables good testing.