Growing Object-Oriented Software, Guided by Tests
18%
off

Growing Object-Oriented Software, Guided by Tests

4.16 (1,675 ratings by Goodreads)
By (author)  , By (author) 

Free delivery worldwide

Available. Dispatched from the UK in 2 business days
When will my order arrive?

Description

Foreword by Kent Beck "The authors of this book have led a revolution in the craft of programming by controlling the environment in which software grows." --Ward Cunningham "At last, a book suffused with code that exposes the deep symbiosis between TDD and OOD. This one's a keeper." --Robert C. Martin "If you want to be an expert in the state of the art in TDD, you need to understand the ideas in this book."--Michael Feathers Test-Driven Development (TDD) is now an established technique for delivering better software faster. TDD is based on a simple idea: Write tests for your code before you write the code itself. However, this "simple" idea takes skill and judgment to do well. Now there's a practical guide to TDD that takes you beyond the basic concepts. Drawing on a decade of experience building real-world systems, two TDD pioneers show how to let tests guide your development and "grow" software that is coherent, reliable, and maintainable. Steve Freeman and Nat Pryce describe the processes they use, the design principles they strive to achieve, and some of the tools that help them get the job done. Through an extended worked example, you'll learn how TDD works at multiple levels, using tests to drive the features and the object-oriented structure of the code, and using Mock Objects to discover and then describe relationships between objects. Along the way, the book systematically addresses challenges that development teams encounter with TDD--from integrating TDD into your processes to testing your most difficult features. Coverage includes * Implementing TDD effectively: getting started, and maintaining your momentum throughout the project* Creating cleaner, more expressive, more sustainable code* Using tests to stay relentlessly focused on sustaining quality * Understanding how TDD, Mock Objects, and Object-Oriented Design come together in the context of a real software development project* Using Mock Objects to guide object-oriented designs* Succeeding where TDD is difficult: managing complex test data, and testing persistence and concurrency
show more

Product details

  • Paperback | 384 pages
  • 176 x 232 x 22mm | 621.42g
  • Pearson Education (US)
  • Addison-Wesley Educational Publishers Inc
  • New Jersey, United States
  • English
  • 0321503627
  • 9780321503626
  • 11,080

Back cover copy

Foreword by Kent Beck ""The authors of this book have led a revolution in the craft of programming by controlling the environment in which software grows." "--Ward Cunningham " " ""At last, a book suffused with code that exposes the deep symbiosis between TDD and OOD. This one's a keeper." "--Robert C. Martin ""If you want to be an expert in the state of the art in TDD, you need to understand the ideas in this book."--"Michael Feathers Test-Driven Development (TDD) is now an established technique for delivering better software faster. TDD is based on a simple idea: Write tests for your code before you write the code itself. However, this "simple" idea takes skill and judgment to do well. Now there's a practical guide to TDD that takes you beyond the basic concepts. Drawing on a decade of experience building real-world systems, two TDD pioneers show how to let tests guide your development and "grow" software that is coherent, reliable, and maintainable. Steve Freeman and Nat Pryce describe the processes they use, the design principles they strive to achieve, and some of the tools that help them get the job done. Through an extended worked example, you'll learn how TDD works at multiple levels, using tests to drive the features and the object-oriented structure of the code, and using Mock Objects to discover and then describe relationships between objects. Along the way, the book systematically addresses challenges that development teams encounter with TDD--from integrating TDD into your processes to testing your most difficult features. Coverage includes - Implementing TDD effectively: getting started, and maintaining your momentum throughout the project - Creating cleaner, more expressive, more sustainable code - Using tests to stay relentlessly focused on sustaining quality - Understanding how TDD, Mock Objects, and Object-Oriented Design come together in the context of a real software development project - Using Mock Objects to guide object-oriented designs - Succeeding where TDD is difficult: managing complex test data, and testing persistence and concurrency
show more

About Steve Freeman

Steve Freeman is an independent consultant specializing in Agile software development. A founder member of the London Extreme Tuesday Club, he was chair of the first XPDay and is a frequent organizer and presenter at international conferences. Steve has worked in a variety of organizations, from writing shrink-wrap software for IBM, to prototyping for major research laboratories. Steve has a Ph.D. from Cambridge University, and degrees in statistics and music. Steve is based in London, UK. Nat Pryce has worked as a programmer, architect, trainer, and consultant in a variety of industries, including sports reportage, marketing communications, retail, telecoms, and finance. With a Ph.D. from Imperial College London, he has also worked on research projects and does occasional university teaching. An early adopter of Extreme Programming, he has written or contributed to several open source libraries that support Test Driven Development. He was one of the founding organizers of the London XPDay and regularly presents at international conferences. Nat is based in London, UK. Freeman and Pryce were joint winners of the 2006 Agile Alliance Gordon Pask award.
show more

Table of contents

Foreword xvPreface xviiAcknowledgments xxiAbout the Authors xxiii PART I: INTRODUCTION 1 Chapter 1: What Is the Point of Test-Driven Development? 3Software Development as a Learning Process 3Feedback Is the Fundamental Tool 4Practices That Support Change 5Test-Driven Development in a Nutshell 6The Bigger Picture 7Testing End-to-End 8Levels of Testing 9External and Internal Quality 10 Chapter 2: Test-Driven Development with Objects 13A Web of Objects 13Values and Objects 13Follow the Messages 14Tell, Don't Ask 17But Sometimes Ask 17Unit-Testing the Collaborating Objects 18Support for TDD with Mock 19 Chapter 3: An Introduction to the Tools 21Stop Me If You've Heard This One Before 21A Minimal Introduction to JUnit 4 21Hamcrest Matchers and assertThat() 24jMock2: Mock Objects 25 PART II: THE PROCESS OF TEST-DRIVEN DEVELOPMENT 29 Chapter 4: Kick-Starting the Test-Driven Cycle 31Introduction 31First, Test a Walking Skeleton 32Deciding the Shape of the Walking Skeleton 33Build Sources of Feedback 35Expose Uncertainty Early 36 Chapter 5: Maintaining the Test-Driven Cycle 39Introduction 39Start Each Feature with an Acceptance Test 39Separate Tests That Measure Progress from Those That Catch Regressions 40Start Testing with the Simplest Success Case 41Write the Test That You'd Want to Read 42Watch the Test Fail 42Develop from the Inputs to the Outputs 43Unit-Test Behavior, Not Methods 43Listen to the Tests 44Tuning the Cycle 45 Chapter 6: Object-Oriented Style 47Introduction 47Designing for Maintainability 47Internals vs. Peers 50No And's, Or's, or But's 51Object Peer Stereotypes 52Composite Simpler Than the Sum of Its Parts 53Context Independence 54Hiding the Right Information 55An Opinionated View 56 Chapter 7: Achieving Object-Oriented Design 57How Writing a Test First Helps the Design 57Communication over Classification 58Value Types 59Where Do Objects Come From? 60Identify Relationships with Interfaces 63Refactor Interfaces Too 63Compose Objects to Describe System Behavior 64Building Up to Higher-Level Programming 65And What about Classes? 67 Chapter 8: Building on Third-Party Code 69Introduction 69Only Mock Types That You Own 69Mock Application Objects in Integration Tests 71 PART III: A WORKED EXAMPLE 73 Chapter 9: Commissioning an Auction Sniper 75To Begin at the Beginning 75Communicating with an Auction 78Getting There Safely 79This Isn't Real 81 Chapter 10: The Walking Skeleton 83Get the Skeleton out of the Closet 83Our Very First Test 84Some Initial Choices 86 Chapter 11: Passing the First Test 89Building the Test Rig 89Failing and Passing the Test 95The Necessary Minimum 102 Chapter 12: Getting Ready to Bid 105An Introduction to the Market 105A Test for Bidding 106The AuctionMessageTranslator 112Unpacking a Price Message 118Finish the Job 121 Chapter 13: The Sniper Makes a Bid 123Introducing AuctionSniper 123Sending a Bid 126Tidying Up the Implementation 131Defer Decisions 136Emergent Design 137 Chapter 14: The Sniper Wins the Auction 139First, a Failing Test 139Who Knows about Bidders? 140The Sniper Has More to Say 143The Sniper Acquires Some State 144The Sniper Wins 146Making Steady Progress 148 Chapter 15: Towards a Real User Interface 149A More Realistic Implementation 149Displaying Price Details 152Simplifying Sniper Events 159Follow Through 164Final Polish 168Observations 171 Chapter 16: Sniping for Multiple Items 175Testing for Multiple Items 175Adding Items through the User Interface 183Observations 189 Chapter 17: Teasing Apart Main 191Finding a Role 191Extracting the Chat 192Extracting the Connection 195Extracting the SnipersTableModel 197Observations 201 Chapter 18: Filling In the Details 205A More Useful Application 205Stop When We've Had Enough 205Observations 212 Chapter 19: Handling Failure 215What If It Doesn't Work? 215Detecting the Failure 217Displaying the Failure 218Disconnecting the Sniper 219Recording the Failure 221Observations 225 PART IV: SUSTAINABLE TEST-DRIVEN DEVELOPMENT 227 Chapter 20: Listening to the Tests 229Introduction 229I Need to Mock an Object I Can't Replace (without Magic) 230Logging Is a Feature 233Mocking Concrete Classes 235Don't Mock Values 237Bloated Constructor 238Confused Object 240Too Many Dependencies 241Too Many Expectations 242What the Tests Will Tell Us (If We're Listening) 244 Chapter 21: Test Readability 247Introduction 247Test Names Describe Features 248Canonical Test Structure 251Streamline the Test Code 252Assertions and Expectations 254Literals and Variables 255 Chapter 22: Constructing Complex Test Data 257Introduction 257Test Data Builders 258Creating Similar Objects 259Combining Builders 261Emphasizing the Domain Model with Factory Methods 261Removing Duplication at the Point of Use 262Communication First 264 Chapter 23: Test Diagnostics 267Design to Fail 267Small, Focused, Well-Named Tests 268Explanatory Assertion Messages 268Highlight Detail with Matchers 268Self-Describing Value 269Obviously Canned Value 270Tracer Object 270Explicitly Assert That Expectations Were Satisfied 271Diagnostics Are a First-Class Feature 271 Chapter 24: Test Flexibility 273Introduction 273Test for Information, Not Representation 274Precise Assertions 275Precise Expectations 277"Guinea Pig" Objects 284 PART V: ADVANCED TOPICS 287 Chapter 25: Testing Persistence 289Introduction 289Isolate Tests That Affect Persistent State 290Make Tests Transaction Boundaries Explicit 292Testing an Object That Performs Persistence Operations 294Testing That Objects Can Be Persisted 297But Database Tests Are S-l-o-w! 300 Chapter 26: Unit Testing and Threads 301Introduction 301Separating Functionality and Concurrency Policy 302Unit-Testing Synchronization 306Stress-Testing Passive Objects 311Synchronizing the Test Thread with Background Threads 312The Limitations of Unit Stress Tests 313 Chapter 27: Testing Asynchronous Code 315Introduction 315Sampling or Listening 316Two Implementations 318Runaway Tests 322Lost Updates 323Testing That an Action Has No Effect 325Distinguish Synchronizations and Assertions 326Externalize Event Sources 326 Afterword: A Brief History of Mock Objects 329Appendix A: jMock2 Cheat Sheet 335Appendix B: Writing a Hamcrest Matcher 343Bibliography 347Index 349
show more

Rating details

1,675 ratings
4.16 out of 5 stars
5 43% (717)
4 37% (613)
3 16% (266)
2 4% (68)
1 1% (11)
Book ratings by Goodreads
Goodreads is the world's largest site for readers with over 50 million reviews. We're featuring millions of their reader ratings on our book pages to help you find your new favourite book. Close X