Practical Object-oriented Design In Ruby

The Complete Guide to Writing Maintainable, Manageable, Pleasing, and Powerful Object-Oriented Applications

The Web is awash in Ruby code that is now virtually impossible to change or extend. This text helps you solve that problem by using powerful real-world object-oriented design techniques, which it thoroughly explains using simple and practical Ruby examples.

While the industry moves more towards Functional Programming Paradigms and away from Object-Oriented Thinking, Sandi Metz's book, Practical Object-Oriented Design in Ruby, published in 2012, still stands the test of time with OOP best-practices. It is truly a practitioner's guide to Navigating Changing Requirements and being truly Agile. Practical Object-Oriented Design in Ruby: An Agile Primer Learn More Buy Object-oriented programming languages contend that they are efficient and effective because of the way they model reality.

Object-oriented programming languages have a point of view about how best to model the world. They exist to help you create beautiful, straightforward applications that are easy to change and simple to extend. Unfortunately, the world is awash with object-oriented (OO) applications that are difficult to understand and expensive to change. Even though they’re written in OO languages, these applications fail to achieve the promise of OO because their code doesn’t reflect the right mindset. The purpose of Practical Object-Oriented Design, Second Edition, is to solve that problem by immersing you in an OO mindset. It teaches powerful, real-world, object-oriented design techniques using simple and practical examples. It will change the way you think about code.

Sandi Metz has distilled a lifetime of conversations and presentations about object-oriented design into a proven set of OO practices for crafting manageable, extensible, and pleasing code. She demonstrates how to build new applications that can “survive success” and how to repair those that have become impossible to change. Each technique is illustrated with extended examples in the easy-to-understand Ruby programming language, all downloadable from the companion website, poodr.com. Fully updated for Ruby 2.5, this guide shows how to:

  • Decide what belongs in a single class
  • Avoid entangling objects that should be kept separate
  • Define flexible interfaces among objects
  • Reduce programming overhead costs with duck typing
  • Successfully apply inheritance
  • Build objects via composition
  • Design cost-effective tests
  • Solve common problems associated with poorly designed object-oriented code

Whatever your previous object-oriented experience, this concise guide will help you achieve the superior outcomes you’re looking for.

Home > Store

Share|

Register your product to gain access to bonus material or receive a coupon.

  • By Sandi Metz
  • Published Sep 5, 2012 by Addison-Wesley Professional. Part of the Addison-Wesley Professional Ruby Series series.

Best Value Purchase

Book + eBook Bundle

  • Your Price: $48.59
  • List Price: $80.98
  • Includes EPUB, MOBI, and PDF
  • This eBook includes the following formats, accessible from your Account page after purchase:

    EPUBThe open industry format known for its reflowable content and usability on supported mobile devices.

    MOBIThe eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

    PDFThe popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

More Purchase Options

Book

  • Your Price: $35.99
  • List Price: $44.99
  • Usually ships in 24 hours.

eBook (Watermarked)

  • Your Price: $28.79
  • List Price: $35.99
  • Includes EPUB, MOBI, and PDF
  • This eBook includes the following formats, accessible from your Account page after purchase:

    EPUBThe open industry format known for its reflowable content and usability on supported mobile devices.

    MOBIThe eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

    PDFThe popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

Description

  • Copyright 2013
  • Dimensions: 7' x 9-1/8'
  • Pages: 272
  • Edition: 1st
  • Book
  • ISBN-10: 0-321-72133-0
  • ISBN-13: 978-0-321-72133-4

The Complete Guide to Writing More Maintainable, Manageable, Pleasing, and Powerful Ruby Applications

Ruby’s widely admired ease of use has a downside: Too many Ruby and Rails applications have been created without concern for their long-term maintenance or evolution. The Web is awash in Ruby code that is now virtually impossible to change or extend. This text helps you solve that problem by using powerful real-world object-oriented design techniques, which it thoroughly explains using simple and practical Ruby examples.

Sandi Metz has distilled a lifetime of conversations and presentations about object-oriented design into a set of Ruby-focused practices for crafting manageable, extensible, and pleasing code. She shows you how to build new applications that can survive success and repair existing applications that have become impossible to change. Each technique is illustrated with extended examples, all downloadable from the companion Web site, poodr.info.

The first title to focus squarely on object-oriented Ruby application design, Practical Object-Oriented Design in Ruby will guide you to superior outcomes, whatever your previous Ruby experience. 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.

This guide will help you

  • Understand how object-oriented programming can help you craft Ruby code that is easier to maintain and upgrade
  • Decide what belongs in a single Ruby class
  • Avoid entangling objects that should be kept separate
  • Define flexible interfaces among objects
  • Reduce programming overhead costs with duck typing
  • Successfully apply inheritance
  • Build objects via composition
  • Design cost-effective tests
  • Solve common problems associated with poorly designed Ruby code

Extras

Related Article

Author's Site

Author suggested site: sandimetz.com

Sample Content

Online Sample Chapter

Sample Pages

Download the sample pages (includes Chapter 3 and Index)

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

Summary 57

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

The Composed Bicycle 180

Deciding Between Inheritance and Composition 184

Summary 190

Practical Object-oriented Design In Ruby

Testing Outgoing Messages 215

Testing Duck Types 219

Testing Inherited Code 229

Object Oriented Design Principles

Summary 240

Afterword 241

Index 243

More Information

Practical Object-oriented Design In Ruby

  • Request an Instructor or Media review copy.

Other Things You Might Like

  • Book $50.99
  • Book $39.99

Practical Object-oriented Design In Ruby Epub

  • Book $39.99

Comments are closed.