The Artima Developer Community
Sponsored Link

Agile Buzz Forum
TDD and Other Thinking Tools

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Keith Ray

Posts: 658
Nickname: keithray
Registered: May, 2003

Keith Ray is multi-platform software developer and Team Leader
TDD and Other Thinking Tools Posted: Apr 18, 2006 8:30 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by Keith Ray.
Original Post: TDD and Other Thinking Tools
Feed Title: MemoRanda
Feed URL: http://homepage.mac.com/1/homepage404ErrorPage.html
Feed Description: Keith Ray's notes to be remembered on agile software development, project management, oo programming, and other topics.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Keith Ray
Latest Posts From MemoRanda

Advertisement

Test driven development (TDD) is a design tool. So is a piece of paper on which you sketch out code. Or a white board on which you sketch out UML diagrams. On a somebody's blog, which I lost the link to, some commenter complained that TDD doesn't force you to do the right thing. Neither do the other tools I just mentioned. These are thinking/design tools.

The design process I go through with white-board, or pencil and paper, or TDD, or just writing code and exercising it in the debugger, is not terribly different for each of these tools. They do have their individual weaknesses: paper or whiteboard means I have to exercise the code in my brain, testing code in the debugger can be slow, TDD tests are not always easy to write.

The key difference with TDD, which is a thinking process that I emphasize isn't too different from designing using the other tools I mentioned, is that after going through this designing-and-coding process, we have unit tests that we can save and run again later. No additional effort required.

Doing design + coding with the other methods does not automatically result in unit tests, so if we want them, we have to make extra effort to write unit tests. And extra effort means things don't get done, or get done grudgingly. This psychological factor is not to be understated: you think you're "done" (coding), so you don't want a failing test to show you that you're not "done". So you don't test very aggressively. In TDD we want the test to fail before we make the test pass, in order to test the test; this is a very different motivation and can actually be fun!

Testing after the fact is more difficult because the code often isn't designed to be testable. "Testable" is a symptom of good design, but rather than seeing that some difficulty in testing is a flaw in our design (which impacts our ego when we think we're good designers), we tend to see the difficulty of writing unit tests after-the-fact as being a flaw in unit testing itself. As a result, many people avoid unit testing, and see experience reports and studies that show unit testing reduces defects and reduces the costs of development as being irrelevant to their situation, or just plain flam-flim and lies.

(By the way, if you design code and unit tests at the same time, that's pretty close to TDD and gets you many if not most of the same benefits. But remember that you and the programmers who do TDD are uncommon programmers.)

Read: TDD and Other Thinking Tools

Topic: Note to Self: No Deployments at 3 AM Previous Topic   Next Topic Topic: Consensus Decision Making

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use