Practical object-oriented design in Ruby : an agile primer / Sandi Metz.
Record details
- ISBN: 0321721330 (alk. paper)
- Physical Description: xxiii, 247 p. : il. (algunas col.) ; 23 cm.
- Publisher: Upper Saddle River, NJ : Addison-Wesley, 2013.
Content descriptions
| Bibliography, etc. Note: | Incluye bibliografía e índice. |
| Formatted Contents Note: | Object-oriented design -- Designing classes with a single responsibility -- Managing dependencies -- Creating flexible interfaces -- Reducing costs with duck typing -- Acquiring behavior through inheritance -- Sharing role behavior with modules -- Combining objects with composition -- Designing cost-effective tests. |
Search for related items by subject
| Subject: | Object-oriented programming (Computer science). Ruby (Computer program language). |
Available copies
- 1 of 1 copy available at IPICYT.
Holds
- 0 current holds with 1 total copy.
Show Only Available Copies
| Location | Call Number / Copy Notes | Barcode | Shelving Location | Status | Due Date |
|---|---|---|---|---|---|
| Biblioteca Ipicyt | QA76.64M4 P7 2013 | LCI00528 | Coleccion General | Available | - |
| Foreword | xv | |
| Introduction | xvii | |
| Acknowledgments | xxi | |
| About the Author | xxiii | |
| 1. | Object-Oriented Design | 1 |
| In Praise of Design | 2 | |
| The Problem Design Solves | 2 | |
| Why Change Is Hard | 3 | |
| A Practical Definition of Design | 4 | |
| The Tools of Design | 4 | |
| Design Principles | 5 | |
| Design Patterns | 6 | |
| The Act of Design | 7 | |
| How Design Fails | 7 | |
| When to Design | 8 | |
| Judging Design | 10 | |
| A Brief Introduction to Object-Oriented Programming | 11 | |
| Procedural Languages | 12 | |
| Object-Oriented Languages | 12 | |
| Summary | 14 | |
| 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 | |
| An Example Application: Bicycles and Gears | 17 | |
| Why Single Responsibility Matters | 20 | |
| Determining If a Class Has a Single Responsibility | 22 | |
| Determining When to Make Design Decisions | 22 | |
| Writing Code That Embraces Change | 24 | |
| Depend on Behavior, Not Data | 24 | |
| Enforce Single Responsibility Everywhere | 29 | |
| Finally, the Real Wheel | 33 | |
| Summary | 34 | |
| 3. | Managing Dependencies | 35 |
| Understanding Dependencies | 36 | |
| Recognizing Dependencies | 37 | |
| Coupling Between Objects (CBO) | 37 | |
| Other Dependencies | 38 | |
| Writing Loosely Coupled Code | 39 | |
| Inject Dependencies | 39 | |
| Isolate Dependencies | 42 | |
| Remove Argument-Order Dependencies | 46 | |
| Managing Dependency Direction | 51 | |
| Reversing Dependencies | 51 | |
| Choosing Dependency Direction | 53 | |
| Summary | 57 | |
| 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 | |
| An Example Application: Bicycle Touring Company | 63 | |
| Constructing an Intention | 64 | |
| Using Sequence Diagrams | 65 | |
| Asking for "What" Instead of Telling "How" | 69 | |
| Seeking Context Independence | 71 | |
| Trusting Other Objects | 73 | |
| Using Messages to Discover Objects | 74 | |
| Creating a Message-Based Application | 76 | |
| Writing Code That Puts Its Best (Inter)Face Forward | 76 | |
| Create Explicit Interfaces | 76 | |
| Honor the Public Interfaces of Others | 78 | |
| Exercise Caution When Depending on Private Interfaces | 79 | |
| Minimize Context | 79 | |
| The Law of Demeter | 80 | |
| Defining Demeter | 80 | |
| Consequences of Violations | 80 | |
| Avoiding Violations | 82 | |
| Listening to Demeter | 82 | |
| Summary | 83 | |
| 5. | Reducing Costs with Duck Typing | 85 |
| Understanding Duck Typing | 85 | |
| Overlooking the Duck | 87 | |
| Compounding the Problem | 87 | |
| Finding the Duck | 90 | |
| Consequences of Duck Typing | 94 | |
| Writing Code That Relies on Ducks | 95 | |
| Recognizing Hidden Ducks | 96 | |
| Placing Trust in Your Ducks | 98 | |
| Documenting Duck Types | 98 | |
| Sharing Code Between Ducks | 99 | |
| Choosing Your Ducks Wisely | 99 | |
| Conquering a Fear of Duck Typing | 100 | |
| Subverting Duck Types with Static Typing | 100 | |
| Static versus Dynamic Typing | 101 | |
| Embracing Dynamic Typing | 102 | |
| Summary | 104 | |
| 6. | Acquiring Behavior Through Inheritance | 105 |
| Understanding Classical Inheritance | 105 | |
| Recognizing Where to Use Inheritance | 106 | |
| Starting with a Concrete Class | 106 | |
| Embedding Multiple Types | 109 | |
| Finding the Embedded Types | 111 | |
| Choosing Inheritance | 112 | |
| Drawing Inheritance Relationships | 114 | |
| Misapplying Inheritance | 114 | |
| Finding the Abstraction | 116 | |
| Creating an Abstract Superclass | 117 | |
| Promoting Abstract Behavior | 120 | |
| Separating Abstract from Concrete | 123 | |
| Using the Template Method Pattern | 125 | |
| Implementing Every Template Method | 127 | |
| Managing Coupling Between Superclasses and Subclasses | 129 | |
| Understanding Coupling | 129 | |
| Decoupling Subclasses Using Hook Messages | 134 | |
| Summary | 139 | |
| 7. | Sharing Role Behavior with Modules | 141 |
| Understanding Roles | 142 | |
| Finding Roles | 142 | |
| Organizing Responsibilities | 143 | |
| Removing Unnecessary Dependencies | 145 | |
| Writing the Concrete Code | 147 | |
| Extracting the Abstraction | 150 | |
| Looking Up Methods | 154 | |
| Inheriting Role Behavior | 158 | |
| Writing Inheritable Code | 158 | |
| Recognize the Antipatterns | 158 | |
| Insist on the Abstraction | 159 | |
| Honor the Contract | 159 | |
| Use the Template Method Pattern | 160 | |
| Preemptively Decouple Classes | 161 | |
| Create Shallow Hierarchies | 161 | |
| Summary | 162 | |
| 8. | Combining Objects with Composition | 163 |
| Composing a Bicycle of Parts | 164 | |
| Updating the Bicycle Class | 164 | |
| Creating a Parts Hierarchy | 165 | |
| Composing the Parts Object | 168 | |
| Creating a Part | 169 | |
| Making the Parts Object More Like an Array | 172 | |
| Manufacturing Parts | 176 | |
| Creating the PartsFactory | 177 | |
| Leveraging the PartsFactory | 178 | |
| The Composed Bicycle | 180 | |
| Deciding Between Inheritance and Composition | 184 | |
| Accepting the Consequences of Inheritance | 184 | |
| Accepting the Consequences of Composition | 187 | |
| Choosing Relationships | 188 | |
| Summary | 190 | |
| 9. | Designing Cost-Effective Tests | 191 |
| Intentional Testing | 192 | |
| Knowing Your Intentions | 193 | |
| Knowing What to Test | 194 | |
| Knowing When to Test | 197 | |
| Knowing How to Test | 198 | |
| Testing Incoming Messages | 200 | |
| Deleting Unused Interfaces | 202 | |
| Proving the Public Interface | 203 | |
| Isolating the Object Under Test | 205 | |
| Injecting Dependencies Using Classes | 207 | |
| Injecting Dependencies as Roles | 208 | |
| Testing Private Methods | 213 | |
| Ignoring Private Methods During Tests | 213 | |
| Removing Private Methods from the Class Under Test | 214 | |
| Choosing to Test a Private Method | 214 | |
| Testing Outgoing Messages | 215 | |
| Ignoring Query Messages | 215 | |
| Proving Command Messages | 216 | |
| Testing Duck Types | 219 | |
| Testing Roles | 219 | |
| Using Role Tests to Validate Doubles | 224 | |
| Testing Inherited Code | 229 | |
| Specifying the Inherited Interface | 229 | |
| Specifying Subclass Responsibilities | 233 | |
| Testing Unique Behavior | 236 | |
| Summary | 240 | |
| Afterword | 241 | |
| Index | 243 |