Am 19.06.2013 17:32, schrieb Szymon Gatner:
On Wednesday, 19 June 2013 at 14:44:26 UTC, irritate wrote:
On Wednesday, 19 June 2013 at 11:01:05 UTC, Szymon Gatner wrote:
D is the only language (that I am aware of) that has first class unit
testing support. What do you think? Do we really just "mentally
masturbate"?
My feelings about TDD changed when I saw that talk explaining TDD
in the context of double-entry bookkeeping in accounting (maybe
linked off of here:
http://unhandled-exceptions.com/blog/index.php/2009/02/15/uncle-bob-tdd-as-double-entry-bookkeeping/).
Writing your tests and code separately is actually an important
part of it. If you are copy-pasting your code into your test
after you write it, then that's not really giving you the
guarantees you want.
And for anyone who's never tried the loop of:
1. Write a failing test.
2. Write the code that makes the test pass.
3. Make all the lights go green, then goto 1.
You might want to give it a try. I was surprised by the feeling
of accomplishment I would get from making the failing tests pass.
irritate
That is actually the way I do TDD too. In fact, doing it any
other way is actually against 3 laws of TDD:
http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd
and is plain wrong. Writing tests for working (legacy) code will
not in any way shape it's structure and often results in useless
tests. TDD is a design technique not a testing technique.
I am pretty sure that many people will agree that TDD works, I
was actually curious on opinion on the presentation which claims
that TDD does not work at all and is in fact total BS.
How do you TDD:
- native application UI code
- embedded native code
- distributed algorithms
- applications done in native languages with third party libraries only
available in binary form
- GPGPU code
Any of those cases full new greenfield applications.
--
Paulo