5 ms·
>I've never heard TDD being that you write all of your tests up front, before you've written any code. That's interesting, because as a non-TDD practitioner wh
by Sir_Substance 9y ago
>I've never heard TDD being that you write all of your tests up front, before you've written any code.
That's interesting, because as a non-TDD practitioner who occasionally gets it evangelized to me, that's certainly how I was told to go about it by multiple people.
Possibly TDD has a marketing problem?
- goldenkey 9y agoTDD doesn't have a marketing problem -- all these sponsored wigs evangelized it for the last 20 years, there's at least a dozen at every conference, many getting paid thousands to give their gritty speeches. TDD as these maggots explained it is: write your tests first, write your code, make sure the tests pass, rinse, repeat.
- logfromblammo 9y agoTDD is writing code to automatically validate that a specification/requirement has been met, before writing the code that meets the requirement. It does one requirement at a time. You might add a specification that the code has to create a list of strings from a data set. You write a test that takes a data set as input and checks the output to see if it is the expected result. This fails, because the code hasn't been written yet. Then you write the simplest function possible to make the test pass. Once it passes, you check to see if anything can be refactored. You can refactor as much or as little as you like, provided that all the tests still pass. Once you're satisfied, you write another test for another requirement. It's like a spinning ratchet wheel, where the test suite is the pawl. It keeps you from backsliding, but you can't spin too fast, or it flies off and won't engage with the wheel. Turn-click-turn-click-turn-click. Writing all your tests up front is one of the worst ideas I have ever heard.
- kevwil 9y agoWow, if that's how people are describing it, no wonder it's seen negatively. That seems very waterfall-ish and horrible. Thankfully that's not TDD as originally intended.