Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Tests are useful on many levels, but at their most basic they provide a second client for your implementation...

I like to say that the tests are the first client :)



And this is a great example of how religious/fundamentalist TDD sounds to non believers.

Let me briefly summarize the above two comments. "We want our code to be modular, composable, and reusable therefore ... you should write your tests before you write your implementation".

Notice the logical leap? Notice the near obsession with the pieces of this phrase that isn't the important part? And tell someone you don't write your tests first and prepare for looks of disgust thrown your way, a public shaming. And Bob himself does this.

> If you aren't doing TDD, or something as effective as TDD, then you should feel bad.


I see where you're coming from, totally. I personally have moved to thinking about writing tests concurrently. That is, maybe a bit before, maybe a bit after, but as a first-class development effort worthy of "real" developer time and not a half-assed afterthought that is delegated to "lesser" team members.

I don't throw around looks of disgust or shame people, but I insist that in 2014, if you don't have meaningful test automation, you don't have much credibility.

I wrote about all of this thrashing over four years ago and I am kind of heartbroken that the conversation hasn't really moved forward at all. http://martin.cron.com/2009/10/21/oh-no-not-more-of-the-same...


Here's the crux of my argument, quality code is not a function of the number of tests. I tried real TDD 5 years ago and I can assure you code I write today (with less tests) is better than the more tested code I wrote 5 years ago.

This means that there is not a clear correlation between number of tests and clean code, yet that is the central premise of the testing religion.


Regardless of anything else, shouldn't your code improve with five years additional experience?


That was my point. Testing is not the primary factor that determines the quality of design. I see it making a marginal difference at best.

Edit: Stupid autocorrect.


> ... you should write your tests before you write your implementation"

should be written more like:

> ... you should PROVE IT"

That is the essence of what we're discussing here, at least from the TDD side of things.




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

Search: