Hacker News new | past | comments | ask | show | jobs | submit login

TDD != writing tests, but it means that you write tests before you code. Many people write tests for their production code, but they mostly add them after at least some of the code has been written.

The idea is that you'll understand the problem space better by writing the test first. Which is IMO a valid assumption. But, at least for me, the problem space (interfaces etc.) is often a bit too fuzzy initially, such that it's easier to just write the first draft, and THEN test that.




This! So many of the comments on this post are about writing tests, rather than writing tests first. I've tried TDD a couple of times and always hated it.

Maybe it's one of those things where you have to get over the hump. But to me it's much more enjoyable to write what I think is the perfect function and then try to break it with my tests.

I also don't understand how anyone could think that a strong typesystem is a replacement for tests. It definitely helps one write a lot fewer tests for the same level of quality, but you still need tests.


I know what TDD means. I write tests before I write my code.

Usually I write out a set of tests (this should this X, Y and Z but not H, I, J) and then I implement whatever thing I need to add.

Same with bug fixes or changes. Bug fix: reproduce in tests, then fix bug. Change: change or create new tests, then update code.


> The amount of people admitting not doing TDD surprises me. I wouldn’t dare to write any production code without a comprehensive suite of tests.

This suggests that you don't understand that people can achieve the stated goal of "a comprehensive suite of tests" without TDD.

Just to be clear, people can be passionate about testing without being passionate about TDD.


Or they can do testing, not do TDD, and be passionate about neither.


You’re right: I don’t understand how people can have proper tests without TDD. I’ve yet to see a project with meaningful tests without TDD


To me, your comment implied otherwise, sorry for assuming wrongly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: