Test Driven Development By Example

by
Edition: 1st
Format: Paperback
Pub. Date: 2002-11-08
Publisher(s): Addison-Wesley Professional
List Price: $49.99

Rent Book

Select for Price
There was a problem. Please try again later.

Rent Digital

Rent Digital Options
Online:1825 Days access
Downloadable:Lifetime Access
$57.59
*To support the delivery of the digital material to you, a digital delivery fee of $3.99 will be charged on each digital item.
$57.59*

New Book

We're Sorry
Sold Out

Used Book

We're Sorry
Sold Out

How Marketplace Works:

  • This item is offered by an independent seller and not shipped from our warehouse
  • Item details like edition and cover design may differ from our description; see seller's comments before ordering.
  • Sellers much confirm and ship within two business days; otherwise, the order will be cancelled and refunded.
  • Marketplace purchases cannot be returned to eCampus.com. Contact the seller directly for inquiries; if no response within two days, contact customer service.
  • Additional shipping costs apply to Marketplace purchases. Review shipping costs at checkout.

Summary

Write clean code that works with the help of this groundbreaking software method. Example-driven teaching is the basis of Beck's step-by-step instruction that will have readers using TDD to further their projects.

Author Biography

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.



Table of Contents

Preface.
Acknowledgments.
Introduction.

I. THE MONEY EXAMPLE.

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

II. The xUnit Example.

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

III. Patterns for Test-Driven Development.

25. Test-Driven Development Patterns.
26. Red Bar Patterns.
27. Testing Patterns.
28. Green Bar Patterns.
29. xUnit Patterns.
30. Design Patterns.
31. Refactoring.
32. Mastering TDD.
Appendix I: Influence Diagrams.
Appendix II: Fibonacci.
Afterword.
Index. 0321146530T10172002

Excerpts

Clean code that works,in Ron Jeffries' pithy phrase, is the goal of Test-Driven Development (TDD). Clean code that works is a worthwhile goal for a whole bunch of reasons. It is a predictable way to develop. You know when you are finished, without having to worry about a long bug trail. It gives you a chance to learn all of the lessons that the code has to teach you. If you only slap together the first thing you think of, then you never have time to think of a second, better thing. It improves the lives of the users of your software. It lets your teammates count on you, and you on them. It feels good to write it. But how do we get to clean code that works? Many forces drive us away from clean code, and even from code that works. Without taking too much counsel of our fears, here's what we do: we drive development with automated tests, a style of development called Test-Driven Development (TDD). In Test-Driven Development, we Write new code only if an automated test has failed Eliminate duplication These are two simple rules, but they generate complex individual and group behavior with technical implications such as the following. We must design organically, with running code providing feedback between decisions. We must write our own tests, because we can't wait 20 times per day for someone else to write a test. Our development environment must provide rapid response to small changes. Our designs must consist of many highly cohesive, loosely coupled components, just to make testing easy. The two rules imply an order to the tasks of programming. Red--Write a little test that doesn't work, and perhaps doesn't even compile at first. Green--Make the test work quickly, committing whatever sins necessary in the process. Refactor--Eliminate all of the duplication created in merely getting the test to work. Red/green/refactor--the TDD mantra. Assuming for the moment that such a programming style is possible, it further might be possible to dramatically reduce the defect density of code and make the subject of work crystal clear to all involved. If so, then writing only that code which is demanded by failing tests also has social implications. If the defect density can be reduced enough, then quality assurance (QA) can shift from reactive work to proactive work. If the number of nasty surprises can be reduced enough, then project managers can estimate accurately enough to involve real customers in daily development. If the topics of technical conversations can be made clear enough, then software engineers can work in minute-by-minute collaboration instead of daily or weekly collaboration. Again, if the defect density can be reduced enough, then we can have shippable software with new functionality every day, leading to new business relationships with customers. So the concept is simple, but what's my motivation? Why would a software engineer take on the additional work of writing automated tests? Why would a software engineer work in tiny little steps when his or her mind is capable of great soaring swoops of design? Courage. Courage Test-driven development is a way of managing fear during programming. I don't mean fear in a bad way--pow widdle prwogwammew needs a pacifiew-but fear in the legitimate, this-is-a-hard-problem-and-I-can't-see-the-end-from-the-beginning sense. If pain is nature's way of saying "Stop!" then fear is nature's way of saying "Be careful." Being careful is good, but fear has a host of other effects. Fear makes you tentative. Fear makes you want to communicate less. Fear makes you shy away from feedback. Fear makes you grumpy. None of these effects are helpful when programming, especially when programming something hard. So the question becomes how we face a difficult s

An electronic version of this book is available through VitalSource.

This book is viewable on PC, Mac, iPhone, iPad, iPod Touch, and most smartphones.

By purchasing, you will be able to view this book online, as well as download it, for the chosen number of days.

Digital License

You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.

More details can be found here.

A downloadable version of this book is available through the eCampus Reader or compatible Adobe readers.

Applications are available on iOS, Android, PC, Mac, and Windows Mobile platforms.

Please view the compatibility matrix prior to purchase.