News for hackers. Stuff that matters.
Re:An External Replication on the Effects of Test-driven Dev... by spatulon on Wednesday October 19, 2016 @07:02AM (#12742706)
This benefit of test-driven design is not obvious (at least it wasn't for me) until you really experience it. Several years back I wasn't aware of the concept of dependency injection, but independently discovered it while trying to unit test some error logging functionality. Previously I'd always used a global/singleton logger object. That always felt wrong, but I always assumed it was necessary until writing unit tests forced me to avoid that design.

Also note that TDD is not the only way of getting this benefit. IMHO Paul Graham's essay Programming Bottom Up[1] and Casey Muratori's concept of 'compression-oriented programming'[2] both espouse this same idea of improving API design by "writing examples of their use."

[1] http://www.paulgraham.com/progbot.html

[2] https://mollyrocket.com/casey/stream_0019.html

Re:An External Replication on the Effects of Test-driven Dev... by ivan_gammel on Wednesday October 19, 2016 @08:09AM (#12743032)
Well, I practiced TDD for no less than 10 years, and its benefits are still not obvious, more like something that needs to be continuously reviewed in the context of the current work. Once you've understood all the design patterns that TDD enforces, you don't need TDD to use them. You just think how you _would_ test your code and defer test implementation for future.
Re:An External Replication on the Effects of Test-driven Dev... by platz on Wednesday October 19, 2016 @11:44AM (#12744793)
Why not just learn the patterns directly?
Re:An External Replication on the Effects of Test-driven Dev... by ivan_gammel on Thursday October 20, 2016 @09:05AM (#12751830)
:) Who said they should not be learned directly? TDD is just a good demonstration of their use.