News for hackers. Stuff that matters.

Ask HN: Do Developers Use TDD?

TDD is something I hear of a lot, but rarely see anyone actually doing in practice. Do you use it?

I'm a Swift/iOS developer and I don't use it.

( 7 comments | 4 points | on HN )
Re:Ask HN: Do Developers Use TDD? by mtmail on Sunday January 17, 2021 @11:19AM (#25811937)
I didn't the first 10 years. Then the projects needed more coordination (team members), more refactoring, future proofing (making sure one can replace individual parts), dealing with external API and simply having had to deal with too many complex bugs. Apart from very visual projects (HTML layout), all libraries, especially open source, I add some tests.

It's usually not 100% TDD: I write code first code, then tests in parallel or shortly after. Striving for 100% test coverage (there are tools for various programming languages) is hard. Only very rare do I write test first, then code. That would require specification from somebody, or e.g. dealing with an external API.

Re:Ask HN: Do Developers Use TDD? by mehagar on Sunday January 17, 2021 @11:37AM (#25812122)
Was a .NET programmer a year ago. Tests regularly took more than several seconds to run, so it wasn't feasible - the feedback loop was too high.

I'm a web developer now (Ruby on Rails), and I rarely do TDD. The feedback loop is quicker, but I still end up not doing it, and feel guilty for it.

Re:Ask HN: Do Developers Use TDD? by stevenalowe on Friday January 22, 2021 @12:41AM (#25868706)
testing paths (integration/acceptance) is N^M complexity (where N is number of function calls in chain and M is the number of significant parameter variants); unit testing is M complexity. writing the unit test first ensures that you know what M is to start with, which makes it much easier to figure out what 'done' looks like
Re:Ask HN: Do Developers Use TDD? by stevenalowe on Sunday January 17, 2021 @12:38PM (#25812793)
TDD since 1999-ish. If you rarely see anyone doing it in practice, you're in the wrong room :)
Re:Ask HN: Do Developers Use TDD? by Akcium on Sunday January 17, 2021 @10:29AM (#25811438)
I don't.

I don't even write tests... sadly but true

Re:Ask HN: Do Developers Use TDD? by razeonex on Sunday January 17, 2021 @11:21AM (#25811973)
I did before, but now I don't.
Re:Ask HN: Do Developers Use TDD? by sidcool on Sunday January 17, 2021 @10:36AM (#25811499)
Yes