Home About News Contact
 

Test-Driven Development: By Example

Overview

Title Test-Driven Development: By Example
Author Kent Beck
Published Nov 2002 by Addison-Wesley (www.aw.com)
ISBN 0-321-14653-0
Pages 240
Category software engineering
User Level intermediate to advanced
Reviewer Anthon Pang
Rating 5 / 5

Synopsis

In "Test-Driven Development", Kent Beck illustrates the TDD techniques using two, small projects as examples. The referenced TDD patterns and refactorings support agile methods, encouraging simple designs and test suites that inspire confidence. The promise: reliable, bug-free code no matter what its level of complexity. (back cover)

Table of Contents

Introduction
Part I: The Money Example

Chapter 1: Multi-Currency Money
Chapter 2: Degenerate Objects
Chapter 3: Equality for All
Chapter 4: Privacy
Chapter 5: Franc-ly Speaking
Chapter 6: Equality for All, Redux
Chapter 7: Apples and Oranges
Chapter 8: Makin' Objects
Chapter 9: Times We're Livin' In
Chapter 10: Interesting Times
Chapter 11: The Root of All Evil
Chapter 12: Addition, Finally
Chapter 13: Make It
Chapter 14: Change
Chapter 15: Mixed Currencies
Chapter 16: Abstraction, Finally
Chapter 17: Money Retrospective

Part II: The xUnit Example

Chapter 18: First Steps to xUnit
Chapter 19: Set the Table
Chapter 20: Cleaning Up After
Chapter 21: Counting
Chapter 22: Dealing with Failure
Chapter 23: How Suite It Is
Chapter 24: xUnit Retrospective

Part III: Patterns for Test-Driven Development

Chapter 25: Test-Driven Development Patterns
Chapter 26: Red Bar Patterns
Chapter 27: Testing Patterns
Chapter 28: Green Bar Patterns
Chapter 29: xUnit Patterns
Chapter 30: Design Patterns
Chapter 31: Refactoring
Chapter 32: Mastering TDD

Appendix I: Influence Diagrams
Appendix II: Fibonacci

Praises

Beck uses tutorials to describe the xUnit test framework and patterns (for testing, design, and refactoring) applied. Note: there are the obvious differences between language-specific implementations (e.g., Java vs. C++), and variations for a given language, such as C++ (i.e., CppUnit, CxxTest, Unit++).

In practice, my experience with TDD is positive. Initially, my productivity on developing new functionality generally felt slower, but that could also have been explained by other things as well (e.g., sometimes focussing too much on portability concerns, and falling back onto top-down coding habits). However, I'm definitely noticed burstiness on refactorings, which supports Beck's claim re: increasing confidence from the tests.

Criticisms

Only a handful of refactorings are provided. For a more comprehensive list, consult "Refactoring" by Martin Fowler.

Final Analysis

TDD advocates bottom-up construction, making all tests pass before adding a new test, refactoring to refine your design, and to not expect "portability" between test frameworks. This book is a must-have/keeper, i.e., it's in the easy-to-reach section of my bookshelf, when it's not on my desk.

Copyright

Copyright © 2003 Anthon Pang.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".