did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780321721334

Practical Object-Oriented Design in Ruby An Agile Primer

by
  • ISBN13:

    9780321721334

  • ISBN10:

    0321721330

  • Format: Paperback
  • Copyright: 2012-09-05
  • Publisher: Addison-Wesley Professional
  • View Upgraded Edition
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $44.99 Save up to $0.22
  • Buy New
    $44.77
    Add to Cart Free Shipping Icon Free Shipping

    USUALLY SHIPS IN 2-3 BUSINESS DAYS

Supplemental Materials

What is included with this book?

Summary

Years after the initial release of Ruby on Rails, the chickens are coming home to roost. Suddenly, anyone could write a web application -- and it seems like everyone did. The web is now awash in Ruby applications that were easy to write but are now virtually impossible to change, extend, or grow. This book solves that problem by teaching developers real-world object oriented design techniques specifically focused on Ruby. Writing for more than 1,000,000 Ruby developers at all levels of experience, Sandi Metz shares knowledge and concrete solutions for creating more extensible, more maintainable applications - and for fixing many of the poorly designed applications they must now manage. The first book to focus squarely on object-oriented Ruby application design, Practical Object Oriented Design in Rubywill guide developers to superior outcomes, even if their previous experience has been strictly limited to "procedural" techniques. Metz distills a lifetime of conversations about object-oriented design and many years of whiteboard drawings into a set of specific Ruby practices and patterns that lead to more manageable and pleasing code. Novice Ruby programmers will find specific "rules to live by"; intermediate Ruby programmers will find valuable principles they can flexibly interpret and apply; and advanced Ruby programmers will find a common language they can use to lead development and guide their colleagues.

Author Biography

Sandi Metz has thirty years of experience working on projects that survived to grow and change. She now writes code every day as a software architect at Duke University, where her team solves real problems for customers who have large object-oriented applications that have been evolving for more than fifteen years. She has spoken at Ruby Nation and speaks regularly at the Gotham Ruby Users Conference.

 

Table of Contents

Foreword         xv

Introduction         xvii

Acknowledgments         xxi

About the Author         xxiii

 

Chapter 1: Object-Oriented Design         1

In Praise of Design   2

The Tools of Design   4

The Act of Design   7

A Brief Introduction to Object-Oriented Programming   11

Summary 14

 

Chapter 2: Designing Classes with a Single Responsibility         15

Deciding What Belongs in a Class   16

Grouping Methods into Classes   16

Organizing Code to Allow for Easy Changes   16

Creating Classes That Have a Single Responsibility   17

Writing Code That Embraces Change   24

Finally, the Real Wheel   33

Summary   34

 

Chapter 3: Managing Dependencies         35

Understanding Dependencies   36

Writing Loosely Coupled Code   39

Managing Dependency Direction   51

Summary   57

 

Chapter 4: Creating Flexible Interfaces         59

Understanding Interfaces   59

Defining Interfaces   61

Public Interfaces   62

Private Interfaces   62

Responsibilities, Dependencies, and Interfaces   62

Finding the Public Interface   63

Writing Code That Puts Its Best (Inter)Face Forward   76

The Law of Demeter   80

Summary   83

 

Chapter 5: Reducing Costs with Duck Typing         85

Understanding Duck Typing   85

Writing Code That Relies on Ducks   95

Conquering a Fear of Duck Typing   100

Summary   104

 

Chapter 6: Acquiring Behavior Through Inheritance         105

Understanding Classical Inheritance   105

Recognizing Where to Use Inheritance   106

Misapplying Inheritance   114

Finding the Abstraction   116

Managing Coupling Between Superclasses and Subclasses   129

Summary 139

 

Chapter 7: Sharing Role Behavior with Modules         141

Understanding Roles   142

Writing Inheritable Code   158

Summary   162

 

Chapter 8: Combining Objects with Composition         163

Composing a Bicycle of Parts   164

Composing the Parts Object   168

Manufacturing Parts   176

The Composed Bicycle   180

Deciding Between Inheritance and Composition   184

Summary   190

 

Chapter 9: Designing Cost-Effective Tests         191

Intentional Testing   192

Testing Incoming Messages   200

Testing Private Methods   213

Testing Outgoing Messages   215

Testing Duck Types   219

Testing Inherited Code   229

Summary 240

 

Afterword         241

 

Index          243

 

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program