ebook img

99 Bottles of OOP: A Practical Guide to Object-Oriented Design (Ruby Edition) PDF

499 Pages·2020·3.809 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview 99 Bottles of OOP: A Practical Guide to Object-Oriented Design (Ruby Edition)

99 Bottles of OOP Metz, Sandi;Owen, Katrina;Stankus, TJ Table of Contents Colophon Your Rights As A Reader Dedication Preface What This Book Is About Who Should Read This Book Before You Read This Book How To Read This Book Code Examples Errata About the Authors About the Translators Introduction 1. Rediscovering Simplicity 1.1. Simplifying Code 1.1.1. Incomprehensibly Concise Consistency Duplication Names 1.1.2. Speculatively General 1.1.3. Concretely Abstract 1.1.4. Shameless Green 1.2. Judging Code 1.2.1. Evaluating Code Based on Opinion 1.2.2. Evaluating Code Based on Facts Source Lines of Code Cyclomatic Complexity Assignments, Branches and Conditions (ABC) Metric 1.2.3. Comparing Solutions 1.3. Summary 2. Test Driving Shameless Green 2.1. Understanding Testing 2.2. Writing the First Test 2.3. Removing Duplication 2.4. Tolerating Duplication 2.5. Hewing to the Plan 2.6. Exposing Responsibilities 2.7. Choosing Names 2.8. Revealing Intentions 2.9. Writing Cost-E�ective Tests 2.10. Avoiding the Echo-Chamber 2.11. Considering Options 2.12. Summary 3. Unearthing Concepts 3.1. Listening to Change 3.2. Starting With the Open/Closed Principle 3.3. Recognizing Code Smells 3.4. Identifying the Best Point of Attack 3.5. Refactoring Systematically 3.6. Following the Flocking Rules 3.7. Converging on Abstractions 3.7.1. Focusing on Di�erence 3.7.2. Simplifying Hard Problems 3.7.3. Naming Concepts 3.7.4. Making Methodical Transformations 3.7.5. Refactoring Gradually 3.8. Summary 4. Practicing Horizontal Refactoring 4.1. Replacing Di�erence With Sameness 4.2. Equivocating About Names 4.3. Deriving Names From Responsibilities 4.4. Choosing Meaningful Defaults 4.5. Seeking Stable Landing Points 4.6. Obeying the Liskov Substitution Principle 4.7. Taking Bigger Steps 4.8. Discovering Deeper Abstractions 4.9. Depending on Abstractions 4.10. Summary 5. Separating Responsibilities 5.1. Selecting the Target Code Smell 5.1.1. Identifying Patterns in Code 5.1.2. Spotting Common Qualities 5.1.3. Enumerating Flocked Method Commonalities 5.1.4. Insisting Upon Messages 5.2. Extracting Classes 5.2.1. Modeling Abstractions 5.2.2. Naming Classes 5.2.3. Extracting BottleNumber 5.2.4. Removing Arguments 5.2.5. Trusting the Process 5.3. Appreciating Immutability 5.4. Assuming Fast Enough 5.5. Creating BottleNumbers 5.6. Recognizing Liskov Violations 5.7. Summary 6. Achieving Openness 6.1. Consolidating Data Clumps 6.2. Making Sense of Conditionals 6.3. Replacing Conditionals with Polymorphism 6.3.1. Dismembering Conditionals 6.3.2. Manufacturing Objects 6.3.3. Prevailing with Polymorphism 6.4. Transitioning Between Types 6.5. Making the Easy Change 6.6. Defending the Domain 6.7. Summary 7. Manufacturing Intelligence 7.1. Contrasting the Concrete Factory with Shameless Green 7.2. Fathoming Factories 7.3. Opening the Factory 7.4. Supporting Arbitrary Class Names 7.5. Dispersing The Choosing Logic 7.6. Self-registering Candidates 7.7. Auto-registering Candidates 7.8. Summary 8. Developing a Programming Aesthetic 8.1. Appreciating the Mechanical Process 8.2. Clarifying Responsibilities with Pseudocode 8.3. Extracting the Verse 8.4. Coding by Wishful Thinking 8.5. Inverting Dependencies 8.5.1. Injecting Dependencies 8.5.2. Isolating Variants 8.5.3. Grappling with Inversion 8.6. Obeying the Law of Demeter 8.6.1. Understanding the Law 8.6.2. Curing Demeter Violations 8.7. Identifying What The Verse Method Wants 8.8. Pushing Object Creation to the Edge 8.9. Summary 9. Reaping the Bene�ts of Design 9.1. Choosing Which Units to Test 9.1.1. Contrasting Unit and Integration Tests 9.1.2. Foregoing Tests 9.2. Reorganizing Tests 9.2.1. Gathering BottleVerse Tests 9.2.2. Revealing Intent 9.3. Seeking Context Independence 9.3.1. Examining Bottles' Responsibilities 9.3.2. Purifying Tests With Fakes 9.3.3. Purging Redundant Tests 9.3.4. Pro�ting from Loose Coupling 9.4. Communicating With the Future 9.4.1. Enriching Code with Signals 9.4.2. Verifying Roles 9.4.3. Obliterating Obsolete Context 9.5. Summary Afterword Appendix A: Initial Exercise Getting the exercise Doing the exercise Test Suite References Acknowledgements Colophon Version: 2.1.1 Version Date: 21-01-20 Published By: Potato Canyon Software, LLC 2nd Edition Copyright: 2021 Cover Design and Art by Lindsey Morris. Edited by Julia Trimmer. Created using Asciidoctor. Ruby Logo: Attribution-ShareAlike 2.5 Generic (CC BY-SA 2.5) Your Rights As A Reader Thank you for buying 99 Bottles of OOP. As the authors of a self- published book, we very much appreciate your purchase. This book is chock-full of lessons, and readers often write asking if they can share them with others. We commend your desire to pass on what you’ve learned, and ask only that while doing so you respect our rights as authors. This means that while we encourage you to spread the underlying ideas of the book, we restrict your use of its actual content (the specific examples, explanations, and descriptions). Our bargain with you is as follows: 1. Your purchase entitles you to a single, non-transferable license for your personal use of the ebook related files. You may read and download the ebook you purchased to your personal devices only. You may not: Sell the book Give it away Distribute it in any way Print it (except for your personal use) 2. You may use 99 Bottles of OOP as curriculum in a public education setting (university, code school, secondary school) as long as every student buys or is provided with a legal copy of the book. Volume discounts are available, and there’s a free-book-for-a- postcard program. Contact [email protected] for information about bulk purchases. 3. You may share one small section (a chapter or less) at a free, public meet-up as long as the material is properly attributed. 4. You may not teach a course based on the entire book, even if this course is free and open to the public. 5. You may not use any part of 99 Bottles of OOP in any endeavor in which you charge for your services.

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.