Deletions are marked like this. | Additions are marked like this. |
Line 17: | Line 17: |
* Alistair Cockburn's [http://alistair.cockburn.us/index.php/Coffee_machine_design_problem,_part_1 Coffee Machine] might make a good example problem. (also see [http://alistair.cockburn.us/index.php/Coffee_machine_design_problem%2C_part_2 part 2].) |
It's hard to come up with good teaching examples of TestDrivenDevelopment that are large enough to be meaningful but small enough to be understood quickly. There are some old chestnuts: Kent Beck used the Money example in Test Driven Development: By Example (0321146530). Uncle Bob Martin and Ron Jeffries have frequently used the Bowling Game example.
Step by step examples
Ron Jeffries' [http://www.xprogramming.com/xpmag/acsBowling.htm Adventures in C#: The Bowling Game] explores bowling scoring in C#.
William Wake's [http://www.xp123.com/xplor/xp0201/index.shtml Test-First Challenge] builds a spreadsheet program in Java. This is one of the best on-line demos I know, as it lets you write the code to make his tests pass. Translating the tests to other languages should be simple. There are also links to several solutions.
William Wake's [http://www.xp123.com/xplor/xp0101/index.shtml The Test-First Stoplight] includes a simple Java example of a Person class.
Will Stott and James Newkirk's [http://msdn.microsoft.com/msdnmag/issues/04/04/ExtremeProgramming/ Test-Driven C#: Improve the Design and Flexibility of Your Project with Extreme Programming Techniques] includes some simple examples
Christopher Bennage's [http://devlicio.us/blogs/christopher_bennage/archive/2007/08/26/tdd-example-querying-a-repository.aspx TDD Example: Querying a Repository] shows a simple test using a database and C#.
Brian Marick's [http://www.exampler.com/blog/2007/06/26/a-workbook-for-practicing-test-driven-design-draft/ A workbook for practicing test-driven design (draft)] uses Java to develop an interface for a simple hierarchical data format.
Scott Bellware's [http://codebetter.com/blogs/scott.bellware/archive/2005/11/23/135001.aspx Test-Driven Development Example: Factorial] walks through developing a factorial calculator in C#.
Code that's been developed using TDD
Brian Button's [http://www.agileprogrammer.com/oneagilecoder/archive/2004/08/10/2868.aspx example of TDDed code]
Problem suggestions that might make good examples
- A mailing list that supports entering a future address change for a person
Alistair Cockburn's [http://alistair.cockburn.us/index.php/Coffee_machine_design_problem,_part_1 Coffee Machine] might make a good example problem. (also see [http://alistair.cockburn.us/index.php/Coffee_machine_design_problem%2C_part_2 part 2].)
Descriptions and explanations of TDD
Scott Ambler's [http://www.agiledata.org/essays/tdd.html Introduction to Test Driven Design] has a good description before it dives into Test Driven Database Development.
Nancy Corbett's [http://www.developer.com/design/article.php/3622546 Test Driven Development, a Portable Methodology] at Developer.com