on Orders of $25 or more*
|Get your books quickly and easily... and pay nothing for shipping. Just order $25 or more and standard shipping is on us (excludes Marketplace and Rental offerings).|
|$3.99 flat rate|
|UPS 2nd Day Air*||$11.99 flat rate|
|UPS Next Day Air*||$19.98 flat rate|
* Not available for PO boxes and APO/FPO
** Saturday delivery is only available in certain areas. UPS standard rates apply.
*** Separate shipping rates apply for bulk orders
Summary: 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 equ ...show moreipped 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. ...show lessEdition/Copyright: 03
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
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.
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 situation and,
Instead of being tentative, begin learning concretely as quickly as possible.
Instead of clamming up, communicate more clearly.
Instead of avoiding feedback, search out helpful, concrete feedback.
(You'll have to work on grumpiness on your own.)
Imagine programming as turning a crank to pull a bucket of water from a well. When the bucket is small, a free-spinning crank is fine. When the bucket is big and full of water, you're going to get tired before the bucket is all the way up. You need a ratchet mechanism to enable you to rest between bouts of cranking. The heavier the bucket, the closer the teeth need to be on the ratchet.
The tests in test-driven development are the teeth of the ratchet. Once we get one test working, we know it is working, now and forever. We are one step closer to having everything working than we were when the test was broken. Now we get the next one working, and the next, and the next. By analogy, the tougher the programming problem, the less ground that each test should cover.
Readers of my book Extreme Programming Explained will notice a difference in tone between Extreme Programming (XP) and TDD. TDD isn't an absolute the way that XP is. XP says, "Here are things you must be able to do to be prepared to evolve further." TDD is a little fuzzier. TDD is an awareness of the gap between decision and feedback during programming, and techniques to control that gap. "What if I do a paper design for a week, then test-drive the code? Is that TDD?" Sure, it's TDD. You were aware of the gap between decision and feedback, and you controlled the gap deliberately.
That said, most people who learn TDD find that their programming practice changed for good. Test Infected is the phrase Erich Gamma coined to describe this shift. You might find yourself writing more tests earlier, and working in smaller steps than you ever dreamed would be sensible. On the other hand, some software engineers learn TDD and then revert to their earlier practices, reserving TDD for special occasions when ordinary programming isn't making progress.
There certainly are programming tasks that can't be driven solely by tests (or at least, not yet). Security software and concurrency, for example, are two topics where TDD is insufficient to mechanically demonstrate that the goals of the software have been met. Although it's true that security relies on essentially defect-free code, it also relies on human judgment about the methods used to secure the software. Subtle concurrency problems can't be reliably duplicated by running the code.
Once you are finished reading this book, you should be ready to
Write automated tests
Refactor to add design decisions one at a time
This book is organized in three parts.
Part I, The Money Example--An example of typical model code written using TDD. The example is one I got from Ward Cunningham years ago and have used many times since: multi-currency arithmetic. This example will enable you to learn to write tests before code and grow a design organically.
Part II, The xUnit Example--An example of testing more complicated logic, including reflection and exceptions, by developing a framework for automated testing. This example also will introduce you to the xUnit architecture that is at the heart of many programmer-oriented testing tools. In the second example, you will learn to work in even smaller steps than in the first example, including the kind of self-referential hoo-ha beloved of computer scientists.
Part III, Patterns for Test-Driven Development--Included are patterns for deciding what tests to write, how to write tests using xUnit, and a greatest-hits selection of the design patterns and refactorings used in the examples.
I wrote the examples imagining a pair programming session. If you like looking at the map before wandering around, then you may want to go straight to the patterns in Part III and use the examples as illustrations. If you prefer just wandering around and then looking at the map to see where you've been, then try reading through the examples, referring to the patterns when you want more detail about a technique, and using the patterns as a reference. Several reviewers of this book commented they got the most out of the examples when they started up a programming environment, entered the code, and ran the tests as they read.
A note about the examples. Both of the examples, multi-currency calculation and a testing framework, appear simple. There are (and I have seen) complicated, ugly, messy ways of solving the same problems. I could have chosen one of those complicated, ugly, messy solutions, to give the book an air of "reality." However, my goal, and I hope your goal, is to write clean code that works. Before teeing off on the examples as being too simple, spend 15 seconds imagining a programming world in which all code was this clear and direct, where there were no complicated solutions, only apparently complicated problems begging for careful thought. TDD can help you to lead yourself to exactly that careful thought.
Beck, Kent : Three Rivers Institute
Kent Beck, one of the software industry's most creative and acclaimed leaders, passionately employs patterns, extreme programming, and test-driven development. Currently affiliated with the Three Rivers Institute, he has been an author of many Addison-Wesley titles.
Get Free Shipping on orders over $25 (not including Rental and Marketplace). Order arrives in 5-10 business days.
Need it faster?
We offer fast, flat-rate expedited shipping options.
|Sell it back by:|
|Guaranteed cash back:|
|Cost of this book|
after cash back:
Take advantage of Guaranteed Cash Back. Send your book to us in good condition before the end of the buyback period, we'll send YOU a check, and you'll pay less for your textbooks!
When you're done with this book, sell it back to Textbooks.com. In addition to the the best possible buyback price, you'll get an extra 10% cash back just for being a customer.
We buy good-condition used textbooks year 'round, 24/7. No matter where you bought it, Textbooks.com will buy your textbooks for the most cash.
Being online is not required for reading an eTextbook after successfully downloading it. You must only be connected to the Internet during the download process.
What is the Marketplace?
It's another way for you to get the right price on the books you need. We approved every Marketplace vendor to sell their books on Textbooks.com, so you know they're all reliable.
What are Marketplace shipping options?
Marketplace items do not qualify for free shipping. When ordering from the Marketplace, please specify whether you want the seller to send your book Standard ($3.99/item) or Express ($6.99/item). To get free shipping over $25, just order directly from Textbooks.com instead of through the Marketplace.
FREE UPS 2nd Day Air TermsRental and Marketplace items are excluded. Offer is valid from 1/21/2013 12:00PM to 1/23/2013 11:59AM CST. Your order must be placed by 12 Noon CST to be processed on the same day. Minimum order value is $100.00 excluding Rental and Marketplace items. To redeem this offer, select "FREE UPS 2ND DAY AIR" at checkout. Offer not is not valid on previous orders.