Programming Books C Java PHP Python Learn more Browse Programming Books

Sorry, this item is not available in
Image not available for
Image not available

To view this video download Flash Player


Sign in to turn on 1-Click ordering
Sell Us Your Item
For a $5.84 Gift Card
Trade in
More Buying Choices
Have one to sell? Sell yours here
Tell the Publisher!
I'd like to read this book on Kindle

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Test Driven Development: By Example [Paperback]

by Kent Beck
4.0 out of 5 stars  See all reviews (54 customer reviews)

Buy New
$35.63 & FREE Shipping. Details
In Stock.
Ships from and sold by Gift-wrap available.
In Stock.
Want it tomorrow, April 25? Choose One-Day Shipping at checkout. Details
Free Two-Day Shipping for College Students with Amazon Student

Sell Us Your Books
Get up to 80% back when you sell us your books, even if you didn't buy them at Amazon. Learn more

Book Description

November 18, 2002 0321146530 978-0321146533 1
Quite simply, test-driven development is meant to eliminate fear in application development. While some fear is healthy (often viewed as a conscience that tells programmers to "be careful!"), the author believes that byproducts of fear include tentative, grumpy, and uncommunicative programmers who are unable to absorb constructive criticism. When programming teams buy into TDD, they immediately see positive results. They eliminate the fear involved in their jobs, and are better equipped to tackle the difficult challenges that face them. TDD eliminates tentative traits, it teaches programmers to communicate, and it encourages team members to seek out criticism However, even the author admits that grumpiness must be worked out individually! In short, the premise behind TDD is that code should be continually tested and refactored. Kent Beck teaches programmers by example, so they can painlessly and dramatically increase the quality of their work.

Frequently Bought Together

Test Driven Development: By Example + Clean Code: A Handbook of Agile Software Craftsmanship + Refactoring: Improving the Design of Existing Code
Price for all three: $112.07

Buy the selected items together

Editorial Reviews

From the Back Cover

Clean code that works--now. This is the seeming contradiction that lies behind much of the pain of programming. Test-driven development replies to this contradiction with a paradox--test the program before you write it.

A new idea? Not at all. Since the dawn of computing, programmers have been specifying the inputs and outputs before programming precisely. Test-driven development takes this age-old idea, mixes it with modern languages and programming environments, and cooks up a tasty stew guaranteed to satisfy your appetite for clean code that works--now.

Developers face complex programming challenges every day, yet they are not always readily prepared to determine the best solution. More often than not, such difficult projects generate a great deal of stress and bad code. To garner the strength and courage needed to surmount seemingly Herculean tasks, programmers should look to test-driven development (TDD), a proven set of techniques that encourage simple designs and test suites that inspire confidence.

By driving development with automated tests and then eliminating duplication, any developer can write reliable, bug-free code no matter what its level of complexity. Moreover, TDD encourages programmers to learn quickly, communicate more clearly, and seek out constructive feedback.

Readers will learn to:

  • Solve complicated tasks, beginning with the simple and proceeding to the more complex.
  • Write automated tests before coding.
  • Grow a design organically by refactoring to add design decisions one at a time.
  • Create tests for more complicated logic, including reflection and exceptions.
  • Use patterns to decide what tests to write.
  • Create tests using xUnit, the architecture at the heart of many programmer-oriented testing tools.
  • This book follows two TDD projects from start to finish, illustrating techniques programmers can use to easily and dramatically increase the quality of their work. The examples are followed by references to the featured TDD patterns and refactorings. With its emphasis on agile methods and fast development strategies, Test-Driven Development is sure to inspire readers to embrace these under-utilized but powerful techniques.


    About the Author

    Kent Beck consistently challenges software engineering dogma, promoting ideas like patterns, test-driven development, and Extreme Programming. Currently affiliated with Three Rivers Institute and Agitar Software, he is the author of many Addison-Wesley titles.

    Product Details

    • Paperback: 240 pages
    • Publisher: Addison-Wesley Professional; 1 edition (November 18, 2002)
    • Language: English
    • ISBN-10: 0321146530
    • ISBN-13: 978-0321146533
    • Product Dimensions: 9.2 x 7.4 x 0.6 inches
    • Shipping Weight: 1.6 pounds (View shipping rates and policies)
    • Average Customer Review: 4.0 out of 5 stars  See all reviews (54 customer reviews)
    • Amazon Best Sellers Rank: #19,872 in Books (See Top 100 in Books)

    More About the Author

    Discover books, learn about writers, read author blogs, and more.

    Customer Reviews

    Most Helpful Customer Reviews
    39 of 40 people found the following review helpful
    5.0 out of 5 stars Fail, Run, Run Clean February 4, 2003
    The are a small number of writers who can teach programming skills effectively. Kent Beck is one of them. There are a small set of practices that you can adopt on your own that will have an clearly observable impact on the quality of your results and the quality of your work day. Test Driven Develoment (TDD) is one of them. If you are a software developer, you want to buy, read and study this book.
    TDD fits development into a three micro-phase cycle: create a test that embodies your requirement, write code that passes the test, make the code run clean. Each phase has different goals, patterns and pitfalls. Like any good coach, Beck walks you through these in detail. He uses multiple examples: most notably a business model in Java and a unit testing framework in Phython. He follows up with a question and answer section that reviews common patterns in test driven development cycle.
    The level of learning involved in doing TDD is profound. The best way to read the book is to do the book. Skills come from doing not reading. I did the examples (in another language) and it made all the difference in what I learned.
    A footnote for managers: TDD is the opening wedge for a set of practices known as extreme programming (XP) or agile development. Test driven development is powerful enough to work on its own for the single delevoper. If you want to realize its full value, however, you need to embrace the full set of XP practices for the whole organization.
    Comment | 
    Was this review helpful to you?
    42 of 45 people found the following review helpful
    4.0 out of 5 stars Good introduction, but light on real-world development November 28, 2003
    If you've never done or are curious about TDD, this is a great book to carefully walk you through learning how and why to do it. After following its practices a bit, I've also found it an indispensible way to write new projects, modules, and code. However, the book doesn't address what happens when:
    - The code base is old, and doesn't have any tests or isn't designed testable. It makes it hard to do anything other than introduce integration-level tests and tweak to success.
    - You're writing UI code for a serious application. It's straightforward to solve for a dialog framework, but when you're integrating with a major windowing framework that embeds serious functionality (Avalon, in my case), there are a whole set of issues he doesn't talk about.
    - Design is part of your deliverable. I don't disagree that you can get pretty reasonble designs out of TDD & refactor. But I *do* disagree that, in practice, you get designs intended to version well, that your company is willing to support for the next decade or more. I've seen the code produced, and it just doesn't happen.
    A good introduction, nonetheless. But watch out before you put on the preacher-hat after reading it and doing the exercises -- at least try to do it in part of one large, real-world product.
    Was this review helpful to you?
    46 of 53 people found the following review helpful
    3.0 out of 5 stars A decent introduciton March 12, 2004
    By Jason
    This Kent Beck title is an introduction to the world of Test-Driven Development (TDD). The book teaches the concepts of TDD by working through two complete sample projects. Along the way, Beck gives the reader valuable insight into the thought process and techniques behind successful test-driven development. When the reader has finished working through these sample projects, he should know enough about TDD to get started working on a TDD project.
    The book is divided into three sections. The first two sections are each walkthroughs of the aforementioned sample projects using TDD. The third section is a collection of notes and useful tips to try to get the most out of TDD. If you've ever read anything from Beck, then you should be familiar with his style. If you haven't, Beck is an engaging enough writer, and the text flows smoothly and is fairly pleasant to read.
    It would help to be familiar with some member of the xUnit family prior to reading this book. Beck uses Java and JUnit for the first section, but never really goes into discussing the JUnit API. Readers unfamiliar with xUnit may have no idea how to proceed with writing their own tests using one of these frameworks. True the API is simple enough that its functions may be ascertained simply by reading the code, but this is no reason not to provide explanation. The second sample project is an actual implementation of xUnit, so a bit more information may be gleaned here. Beck made the curious decision to use Python as the language of implementation for the second project, although he does provide explanation of the language's fundamentals. Finally, none of the sample projects are really complicated enough to do more than get us going on the path of TDD.
    Read more ›
    Was this review helpful to you?
    11 of 12 people found the following review helpful
    Many other reviewers have, with some justification, bemoaned the crunchingly slow pace of this book. Yes, the book moves through its examples slowly. Yes, sometimes Beck's mock humility comes off more than a little snide. It's not perfect on those counts, but please keep in mind that this is a book about a _process_, not a _result_.

    The first example takes up almost half the book just to go through a pretty minimal implementation of a multi-currency representation for money. If this were a book about how to implement money representations, it would be a dismal failure. But of course, that's not the point at all -- the point is to use an example that's simple (so as not to be distracting), but just complex enough to produce adequate talking points to drive a discussion about test-driven development (TDD).

    TDD is incredibly important, surprisingly late in arriving as a TLA unto itself, and Beck certainly gets points (cf. the review about "90% is just showing up") for producing a good straightforward introduction that's sorely needed. Nobody's going to come away from this book feeling filled to the brim with facts and sophisticated techniques. It's a short book (around 200 pages), and its pace is unhurried. What it does is focus on _fundamentals_.

    TDD is all about buyin -- once you "get religion" and become "test-infected" (per Gamma), you've got a solid basis to grow from. It's about habits, and habits can be hard to teach. What's obvious to one person is mysterious to the next. Beck's approach of "sit here with me and listen to my thoughts on a simple, representative problem" is perfectly adequate. It concedes (repeatedly) that some of the steps are obvious, but the pages quickly and one never feels truly bogged down.
    Read more ›
    Comment | 
    Was this review helpful to you?
    Most Recent Customer Reviews
    5.0 out of 5 stars Read this book.
    If you write software, do yourself a favor and read this book. As someone who was firmly in the "unit testing takes away time from getting work done! Read more
    Published 7 days ago by David V.
    5.0 out of 5 stars excellent book
    I have found this book very useful - although i don't use much of the Java programming language (on which examples are based), but it does not affect readability nor usefulness or... Read more
    Published 2 months ago by Nikola Radovanovic
    3.0 out of 5 stars Good but practical only under some circumstances
    Easy to apply to simple logic and short codes. Doesn't easily scale.
    Easy to apply to simple logic and short codes. Doesn't easily scale.
    Published 2 months ago by Brèhanu Meta
    5.0 out of 5 stars The best of TDD
    One of the best books on TDD. I never knew TDD and I desparately was trying to learn in short period of time. Kent Beck came to my rescue.
    Published 3 months ago by Gokul
    5.0 out of 5 stars Highly recommended
    Very nice book. Explains the subject in a very interesting way and answers a lot of questions which are quite common from people learning TDD. Read more
    Published 5 months ago by Andre Willik Valenti
    5.0 out of 5 stars A masterpiece
    Kent Beck gives an awesome introduction to test driven development, with examples that are easy to follow. Read more
    Published 5 months ago by Tor Kreutzer
    5.0 out of 5 stars Awesome
    TDD explained by the master. Examples in Java which didn't matter to much to me, I work in C# and Javascript and was able to relate.
    Published 8 months ago by Ash
    5.0 out of 5 stars Well written. Clear example.
    The writer have really strong knowledge about what he write and from what I have read. It made me realized that this book write from normal human being to normal human being like... Read more
    Published 13 months ago by Peerawat Poombua
    5.0 out of 5 stars Marvelous techniques...
    My question is, "Why did Microsoft take so long to put the toolset in their product." This is by far the best way to program and it's implecations are far reaching and this... Read more
    Published 13 months ago by Kent G
    5.0 out of 5 stars Great Book
    This is a must read for any professional developer. Even if you don't plan on practicing test-driven development, a thorough understanding of the idea is immensely useful.
    Published 18 months ago by rdawe
    Search Customer Reviews
    Only search this product's reviews

    What Other Items Do Customers Buy After Viewing This Item?

    Sell a Digital Version of This Book in the Kindle Store

    If you are a publisher or author and hold the digital rights to a book, you can sell a digital version of it in our Kindle Store. Learn more


    Topic From this Discussion
    church on cover
    Yep, have a look here:

    Title: Chartres Cathedral at Night.
    Apr 27, 2011 by G. Stephenson |  See all 2 posts
    Have something you'd like to share about this product?
    Start a new discussion
    First post:
    Prompts for sign-in

    Search Customer Discussions
    Search all Amazon discussions

    Look for Similar Items by Category