May 13, 2017
"Test-Driven Development" - The Clue's In The NameWhen devs tell me that they do Test-Driven Development "pragmatically", I'm immediately curious as to what they mean by that. Anyone with sufficient experience in software development will be able to tell you that "pragmatic" is secret code for "not actually doing it".
Most commonly, "pragmatic" TDD turns out to mean declaring implementation classes and interfaces first, and then writing tests for them. This is not TDD, pragmatic or otherwise. The clue's in the name.
Alarmingly, quite a few online video tutorials in TDD do exactly this. So it's understandable how thousands of devs can end up thinking it's the correct way to do it.
But when someone tells you that you don't need to start by writing a failing test, what they're really saying is you don't have to do TDD. And they're right. You don't.
But if you're doing TDD, then putting the test first is kind of the whole point.
It's like telling someone that it's okay to have a pork pie if you're a vegan. What they mean is "You don't have to be vegan".
If you're going vegan, pork pies are out. And if you're doing TDD, writing implementation code first is a no-no.
Good. I'm glad we got that sorted.
Posted 1 year ago on May 13, 2017