Live data from Hacker News

Test-Driven Development is Stupid

geometrian.com

11–20 of 154 posts

Re: Test-Driven Development is Stupid

#11
I love the first quote for how (ironically) true it is:

"Trying to improve software quality by increasing the amount of testing is like try[ing] to lose weight by weighing yourself more often."

From someone who has lost over 15kg in the past in few months, one of the things that helped most was starting weighing myself as I didn't do that previously. It kept reminding me that I wasn't still there and gave me more motivation

Re: Test-Driven Development is Stupid

#12
post #6

> I am against writing unit tests in general, since experience shows that they actually prevent high-quality code from emerging from development And he's lost me in his first sentence. Unit testing, good unit testing at least, is not just about developing as it is about preventing regressions. A unit test that runs on every build ensure that something is true and that it stays true forever.

[deleted]

Re: Test-Driven Development is Stupid

#15

I love the first quote for how (ironically) true it is: "Trying to improve software quality by increasing the amount of testing is like try[ing] to lose weight by weighing yourself more often." From someone who has lost over 15kg in the past in few months, one of the things that helped most was starting weighing myself as I didn't do that previously. It kept reminding me that I wasn't still there and gave me more mot…

And it's actually been confirmed in a recent study:

"Frequent Self-Weighing and Visual Feedback for Weight Loss in Overweight Adults"

"The major finding of this study is that the use of frequent weighing accompanied by visual feedback of weight, without a prescribed diet or exercise plan, was effective in producing a small but sustainable weight loss in overweight males."

http://www.hindawi.com/journals/jobe/2015/763680/

Re: Test-Driven Development is Stupid

#16
There're already people speaking about the limits of a too strict TDD:

http://david.heinemeierhansson.com/2014/tdd-is-dead-long-liv...

And yes, it may be stupid to test before a design emerges - but only if you start with a very fine-grained test. Usually when I'm coding from scratch I write a very, very, VERY coarse-grained test that "tests something", and when I reach the point of passing it (which may involved creating and designing multiple classes) I probably have a working design and I may begin creating other, smaller unit tests for individual components. The initial test may disappear or become an integration or acceptance test.

By the way there's little content in the article. It's just a rant. And the article about not writing test cases at all is simply ridiculous - since an error can exist in a test, we shouldn't write test cases?!?

Re: Test-Driven Development is Stupid

#17
post #6

> I am against writing unit tests in general, since experience shows that they actually prevent high-quality code from emerging from development And he's lost me in his first sentence. Unit testing, good unit testing at least, is not just about developing as it is about preventing regressions. A unit test that runs on every build ensure that something is true and that it stays true forever.

It depends what you're developing, and who you're developing with. If you're developing something which must work 100% every time or else someone will die, then unit tests are a must. If you're developing with people who break the build all the time, then unit tests are useful. Unit tests that aren't 100% up to date with the code are worse than no unit tests.

> Unit tests that aren't 100% up to date with the code are worse than no unit tests.

A bit of a tautology... broken code is broken. Unmaintained code, even unit tests, should be deleted.

Re: Test-Driven Development is Stupid

#18
TDD assumes you know what all the interfaces are going to be beforehand. If you discover that an interface needs to change you have to refactor all of your tests. Unit tests are momentum against change.

It also assumes a bug free app with 100% code coverage is the objective, regardless of the cost it takes to write all that test code. An app that has a few bugs but takes half the resources to develop can make better business sense.

Re: Test-Driven Development is Stupid

#19
post #4

A while back I described the benefits I think unit tests give you: 1. Well-tested parts 2. Decoupled design 3. Rapid feedback 4. Local context to test in. At the same time, there are many cases where they don't help much. More here: http://henrikwarne.com/2014/09/04/a-response-to-why-most-uni...

I think you're missing the most important one: ensuring you don't unexpectedly break your own code in the future (when you come back in 6 months and forget why exactly it's arr[1:n-1] not arr[0:n-1] or arr[1:n]).

Re: Test-Driven Development is Stupid

#20
post #6

> I am against writing unit tests in general, since experience shows that they actually prevent high-quality code from emerging from development And he's lost me in his first sentence. Unit testing, good unit testing at least, is not just about developing as it is about preventing regressions. A unit test that runs on every build ensure that something is true and that it stays true forever.

It depends what you're developing, and who you're developing with. If you're developing something which must work 100% every time or else someone will die, then unit tests are a must. If you're developing with people who break the build all the time, then unit tests are useful. Unit tests that aren't 100% up to date with the code are worse than no unit tests.

On the teams I've work on, pushing code that doesn't build and pass all unit tests is grounds for mocking. I have an alias in my zshrc file called "safepush" that runs [clean command] && [build command] && [test command] && git push

If any piece doesn't succeed, the command stops. No push without unit tests passing.

Post reply on HN