promo_download_app_ios_2023
Натисніть знайти для пошуку
Working Effectively with Legacy Code, Michael Feathers
Working Effectively with Legacy Code, Michael Feathers

Основні характеристики

Стан

Користувальницькі характеристики

Папір
біла, оффсет
Рік
2005
Обкладинка
м'яка
Сторінок
456
Мова
Англійська
Опис товару
Get more out of your legacy systems: more performance, functionality, reliability, and manageability Is your code easy to change? Can you get nearly instantaneous feedback when you do change it? Do you understand it? If the answer to any of these questions is no, you have legacy code, and it is draining time and money away from your development efforts. In this book, Michael Feathers offers start-to-finish strategies for working more effectively with large, untested legacy code bases. This book draws on material Michael created for his renowned Object Mentor seminars: techniques Michael has used in mentoring to help hundreds of developers, technical managers, and testers bring their legacy systems under control. adding features fixing bugs, improving design, optimizing performance Getting legacy code into a test harness Writing tests that protect against you introducing new problems Techniques that can be used with any language or platform--with examples in Java, C++, C, and C# Accurately identifying where code changes need to be made Coping with legacy systems that aren " t object-oriented Handling applications that don t seem to have any structureThis book also includes a catalog of twenty-four dependency-breaking techniques that help you work program with elements in isolation and make safer changes. (c) Copyright Pearson Education. All rights reserved. Foreword by Robert C. Martin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi PART I: The Mechanics of Change. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 1: Changing Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Four Reasons to Change Software . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Risky Change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Chapter 2: Working with Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 What Is Unit Testing? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Higher Level Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Test Coverings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 The Legacy Code Change Algorithm . . . . . . . . . . . . . . . . . . . . . . . 18 Chapter 3: Sensing Separation and . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Faking Collaborators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Chapter 4: The Model Seam. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 A Huge Sheet of Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Seams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Seam Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Chapter 5: Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Automated Refactoring Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Mock Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Unit-Testing Harnesses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 General Test Harnesses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 viii CONTENTS PART II: Changing Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 Chapter 6: I don't Have Much Time and I Have to Change It. . . . . . . . . . . 57 Sprout Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59 Sprout Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63 Wrap Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67 Wrap Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Chapter 7: It Takes Forever to Make a Change . . . . . . . . . . . . . . . . . . . . . . 77 Understanding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .77 Lag Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .78 Breaking Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85 Chapter 8: How Do I Add a Feature? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Test-Driven Development (TDD) . . . . . . . . . . . . . . . . . . . . . . . . . . .88 Programming by Difference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104 Chapter 9: I can't Get This Class into a Test Harness . . . . . . . . . . . . . . . . 105 The Case of the подразнюючий для очей та Parameter . . . . . . . . . . . . . . . . . . . . . . .106 The Case of the Hidden Dependency . . . . . . . . . . . . . . . . . . . . . . .113 The Case of the Construction Blob . . . . . . . . . . . . . . . . . . . . . . . .116 The Case of the подразнюючий для очей та Global Dependency . . . . . . . . . . . . . . . .118 The Case of the Horrible Include Dependencies . . . . . . . . . . . . . . .127 The Case of the Onion Parameter . . . . . . . . . . . . . . . . . . . . . . . . .130 The Case of the Parameter Aliased . . . . . . . . . . . . . . . . . . . . . . . . .133 Chapter 10: I can't Run This Method in a Test Harness . . . . . . . . . . . . . . 137 The Case of the Hidden Method . . . . . . . . . . . . . . . . . . . . . . . . . .138 The Case of the "Helpful" Language Feature . . . . . . . . . . . . . . . . .141 The Case of the Undetectable Side Effect . . . . . . . . . . . . . . . . . . . .144 Chapter 11: I Need to Make a Change. What Methods Should I Test? . . . 151 Reasoning About Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151 Reasoning Forward . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .157 Effect Propagation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163 Tools for Effect Reasoning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165 Learning from Effect Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . .167 Simplifying Effect Sketches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .168 CONTENTS ix Chapter 12: I Need to Make Changes in Many One Area. . . . . . . . . . . . . . 173 Interception Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 Judging Design with Pinch Points . . . . . . . . . . . . . . . . . . . . . . . . . 182 Pinch Point Traps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Chapter 13: I Need to Make a Change, but I don't Know What Tests to Write . . . . . . . . . . . . . . . . . . 185 Characterization Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Characterizing Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Targeted Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 A Heuristic for Writing Characterization Tests . . . . . . . . . . . . . . . 195 Chapter 14: Dependencies on Libraries Are Killing Me . . . . . . . . . . . . . . . 197 Chapter 15: My Application Is All API Calls . . . . . . . . . . . . . . . . . . . . . . . 199 Chapter 16: I don't Understand the Code Well Enough to Change It . . . . 209 Notes/Sketching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Listing Markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 Scratch Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Delete Unused Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 Chapter 17: My Application Has No Structure . . . . . . . . . . . . . . . . . . . . . 215 Telling the Story of the System . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Naked CRC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Conversation Scrutiny . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Chapter 18: My Test Code Is in the Way . . . . . . . . . . . . . . . . . . . . . . . . . . 227 Class Naming Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 Test Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Chapter 19: My Project Is Not Object Oriented. How Do I Make Safe Changes?. . . . . . . . . . . . . . . . . . . . . . . . 231 An Easy Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 A Hard Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 Adding New Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 Taking Advantage of Object Orientation . . . . . . . . . . . . . . . . . . . 239 it's All Object Oriented . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 Chapter 20: This Class Is Too Big and I don't Want It to Get Any Bigger . 245 Seeing Responsibilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 x CONTENTS Other Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .265 Moving Forward . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .265 After Class Extract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .268 Chapter 21: i'm Changing the Same Code All Over the Place . . . . . . . . . . 269 First Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .272 Chapter 22: I Need to Change a Monster Method and I can't Write Tests for It . . . . . . . . . . . . . . . . . . . . . . . . . 289 Varieties of Monsters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .290 Tackling Monsters with Automated Refactoring Support . . . . . . .294 The Manual Refactoring Challenge . . . . . . . . . . . . . . . . . . . . . . . .297 Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304 Chapter 23: How Do I Know That i'm Not Breaking Anything?. . . . . . . . 309 Hyperaware Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .310 Single-Goal Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .311 Preserve Signatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .312 Lean on the Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .315 Chapter 24: We Feel себе пригніченими. It isn't Going to Get Any Better. . . . . .319 PART III: Dependency-Breaking Techniques . . . . . . . . . . . . . . . . . . . .323 Chapter 25: Dependency-Breaking Techniques . . . . . . . . . . . . . . . . . . . . . 325 Adapt Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .326 Break Out Method Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .330 Definition Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .337 Encapsulate Global References . . . . . . . . . . . . . . . . . . . . . . . . . . . .339 Expose Static Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .345 Extract and Override Call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .348 Extract and Override Factory Method . . . . . . . . . . . . . . . . . . . . . .350 Extract and Override Getter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .352 Extract Implementer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .356 Extract Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .362 Introduce Instance Delegator . . . . . . . . . . . . . . . . . . . . . . . . . . . . .369 Introduce Static Setter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .372 Link Substitution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .377 Parameterize Constructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .379 Parameterize Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .383 CONTENTS xi Primitivize Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 Pull Up Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 Push-Down Dependency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392 Replace Function with Function Pointer . . . . . . . . . . . . . . . . . . . . 396 Replace Global with Reference Getter . . . . . . . . . . . . . . . . . . . . . 399 Subclass and Method Override . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 Supersede Instance Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 Template Redefinition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 Text Redefinition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 Appendix: Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 Extract Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Відгуки про
590 
В наявності
Код: sku451

Working Effectively with Legacy Code, Michael Feathers

Способи оплати
Післяплата
Оплата на рахунок
Способи доставки
Нова Пошта
Нова Пошта
від 50 грн
Регіони доставки
Умови повернення
Повернення товару впродовж 14 днів за рахунок покупця
Інші товари продавця
Подібні товари інших продавців
Дивіться також
Новинки в категорії книги для вашого хобі
Улюблені товари покупців