Note: Supplemental materials are not guaranteed with Rental or Used book purchases.
Purchase Benefits
What is included with this book?
Russ Olsen has been building software for more than twenty-five years. He has led projects through several generations of programming technologies, from FORTRAN to C to C++ to Java, and now Ruby. He has been using and teaching Ruby since 2002. Olsen writes the popular technology blog Technology As If People Mattered (http://www.russolsen.com).
Foreword | p. xvii |
Preface | p. xix |
Acknowledgments | p. xxv |
About the Author | p. xxvii |
Patterns and Ruby | p. 1 |
Building Better Programs with Patterns | p. 3 |
The Gang of Four | p. 4 |
Patterns for Patterns | p. 4 |
Separate Out the Things That Change from Those That Stay the Same | p. 5 |
Program to an Interface, Not an Implementation | p. 5 |
Prefer Composition over Inheritance | p. 7 |
Delegate, Delegate, Delegate | p. 12 |
You Ain't Gonna Need It | p. 13 |
Fourteen Out of Twenty-Thre | p. 15 |
Patterns in Ruby? | p. 17 |
Getting Started with Ruby | p. 19 |
Interactive Ruby | p. 20 |
Saying Hello World | p. 20 |
Variables | p. 23 |
Fixnums and Bignums | p. 24 |
Floats | p. 26 |
There Are No Primitives Here | p. 26 |
But Sometimes There Is No Object | p. 27 |
Truth, Lies, and nil | p. 28 |
Decisions, Decisions | p. 30 |
Loops | p. 32 |
More about Strings | p. 34 |
Symbols | p. 37 |
Arrays | p. 38 |
Hashes | p. 40 |
Regular Expressions | p. 40 |
A Class of Your Own | p. 41 |
Getting at the Instance Variables | p. 43 |
An Object Asks: Who Am I? | p. 46 |
Inheritance, Subclasses, and Superclasses | p. 46 |
Argument Options | p. 47 |
Modules | p. 49 |
Exceptions | p. 52 |
Threads | p. 53 |
Managing Separate Source Files | p. 54 |
Wrapping Up | p. 55 |
Patterns in Ruby | p. 57 |
Varying the Algorithm with the Template Method | p. 59 |
Keeping Up with What Life Throws at You | p. 60 |
Separate the Things That Stay the Same | p. 61 |
Discovering the Template Method Pattern | p. 65 |
Hook Methods | p. 66 |
But Where Are All the Declarations? | p. 68 |
Types, Safety, and Flexibility | p. 69 |
Unit Tests Are Not Optional | p. 71 |
Using and Abusing the Template Method Pattern | p. 73 |
Templates in the Wild | p. 74 |
Wrapping Up | p. 75 |
Replacing the Algorithm with the Strategy | p. 77 |
Delegate, Delegate, and Delegate Again | p. 78 |
Sharing Data between the Context and the Strategy | p. 80 |
Duck Typing Yet Again | p. 82 |
Procs and Blocks | p. 84 |
Quick-and-Dirty Strategies | p. 88 |
Using and Abusing the Strategy Pattern | p. 90 |
The Strategy Pattern in the Wild | p. 90 |
Wrapping Up | p. 92 |
Keeping Up with the Times with the Observer | p. 95 |
Staying Informed | p. 95 |
A Better Way to Stay Informed | p. 97 |
Factoring Out the Observable Support | p. 100 |
Code Blocks as Observers | p. 104 |
Variations on the Observer Pattern | p. 105 |
Using and Abusing the Observer Pattern | p. 106 |
Observers in the Wild | p. 108 |
Wrapping Up | p. 109 |
Assembling the Whole from the Parts with the Composite | p. 111 |
The Whole and the Parts | p. 112 |
Creating Composites | p. 114 |
Sprucing Up the Composite with Operators | p. 118 |
An Array as a Composite? | p. 119 |
An Inconvenient Difference | p. 120 |
Pointers This Way and That | p. 120 |
Using and Abusing the Composite Pattern | p. 122 |
Composites in the Wild | p. 123 |
Wrapping Up | p. 125 |
Reaching into a Collection with the Iterator | p. 127 |
External Iterators | p. 127 |
Internal Iterators | p. 130 |
Internal Iterators versus External Iterators | p. 131 |
The Inimitable Enumerable | p. 133 |
Using and Abusing the Iterator Pattern | p. 134 |
Iterators in the Wild | p. 136 |
Wrapping Up | p. 140 |
Getting Things Done with Commands | p. 143 |
An Explosion of Subclasses | p. 144 |
An Easier Way | p. 145 |
Code Blocks as Commands | p. 147 |
Commands That Record | p. 148 |
Being Undone by a Command | p. 151 |
Queuing Up Commands | p. 154 |
Using and Abusing the Command Pattern | p. 154 |
The Command Pattern in the Wild | p. 155 |
ActiveRecord Migrations | p. 155 |
Madeleine | p. 156 |
Wrapping Up | p. 160 |
Filling in the Gaps with the Adapter | p. 163 |
Software Adapters | p. 164 |
The Near Misses | p. 167 |
An Adaptive Alternative? | p. 168 |
Modifying a Single Instance | p. 170 |
Adapt or Modify? | p. 172 |
Using and Abusing the Adapter Pattern | p. 173 |
Adapters in the Wild | p. 173 |
Wrapping Up | p. 174 |
Getting in Front of Your Object with a Proxy | p. 175 |
Proxies to the Rescue | p. 176 |
The Protecti | |
Table of Contents provided by Publisher. All Rights Reserved. |
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.