This document discusses test-driven development (TDD) and its benefits. It notes that TDD can find bugs earlier and reduce costs, though traditional testing is still needed. TDD involves writing a test first, then code to pass the test, and refactoring code while ensuring all tests remain passing. Practicing TDD through coding "katas" or exercises in a "dojo" setting can improve skills over time through repetition. While TDD takes more initial time, the benefits are more confidence, productivity, reliability and agility in the long run.
3. The Problem
● Bugs are costly
● Fixing bugs reported
from testers costs
even more
● Fixing bugs reported
from en users costs
even more than "even
more"
5. IBM & Microsoft Report
● 40 - 90% fewer bugs
discovered during
testing
● 15 - 35% more time
spent on
development
6. TDD vs Traditional Testing
Doesn't remove the
need for regular,
traditional testing:
● Exploratory testing
● QA testing
● User Interface testing
● Performance testing
● ...
7. Test-Driven Developmemt
Kent Beck on TDD:
I'm not a great
programmer,
I'm just a good
programmer with
great habits.
8. Red, Green, Refactor
● Write a test, get it to
compile, get a red bar
● Quickly make the test
pass, get a green bar
● Refactor, "clean
code", run tests
frequently - the "bar"
should stay green
9. Another Take
● write test first
● write smallest possible
implementation
● clean up
➔ no "dead" code - it's all
covered
➔ nice API - designed
outside in
10. Baby Steps
● as small as possible
● as large as is
comfortable
● experience of TDD
● technology knowledge
● boldness
● understanding of the
problem domain
12. Benefits
● More confident
● More productive
● More reliable
● More agile
13. Drawbacks
● More code to
maintain
● Takes longer
● Easy to learn, but
harder to master
14. JDojo@Gbg
A safe environment to
learn coding skills such
as
Test-driven Development
and writing
clean code
15. Dave Thomas - Kata
"Pragmatic Dave":
A kata is an exercise in
karate where you repeat
a form many, many
times, making little
improvements in each.
16. The Coder's Dojo
Concept presented at XP 2005 by
Laurent Bossavi and Emmanuel Gaillot
17. Coding Dojo
● A moderator
presents a kata
● Solve the kata, and ...
● Learn from others,
teach what you know
● Short retrospective
18. Kata
● Small programming
exercise - 1-2 hours
● Start from scratch
● Strictly test-driven
● Next time, start over
and try new approach
● Practice until you
master the kata
19. Dojo Rules
● Don't criticize until we
have a green bar
● Strict usage of TDD
● Everyone's obligation
to point out any non-
TDD behaviour
21. All vector art comes from Gnome base icon set, which is licensed under LGPL.
download.gnome.org/sources/gnome-icon-theme
Man on vacuum cleaner from
tpp-bloggen.
Firebug logotype from
getfirebug.com
Baby Steps photo from
seandreilinger at flickr.com
Picture of Dave Thomas from
x180 at flickr.com
Picture of Kent Beck from
Three Rivers Institute web site