- Paperback | 256 pages
- 100 x 100 x 100mm | 100g
- 04 Sep 2003
- Pearson Education (US)
- Addison-Wesley Educational Publishers Inc
- New Jersey, United States
Other books in this series
09 May 2007
Back cover copy
For many, the obstacle to learning refactoring is in identifying the smells--the potential problem areas-found in code. Instead of having you read about the smells, Refactoring Workbook makes sure you understand them. You'll solve a carefully assembled series of problems, and you'll find yourself learning at a deeper level and arriving at a few insights of your own. Wake uses the workbook method--a learning-focused approach that forces you to apply the techniques presented in the book-in the rest of the book. This approach helps you learn and apply the most important refactoring techniques to your code and, as a side benefit, helps you to think more about creating great code even when you're not refactoring.
Refactoring Workbook provides user-friendly references such as: A handy, quick-reference smell finder A standard format for describing smells Appendices showing key refactorings A listing of Java(TM) tools that support refactoring
This book is intended for programmers with a knowledge of Java, though a C# or C++ programmer with a basic understanding of Java would also be able to follow and learn from the examples. It can be used as a companion to Martin Fowler's Refactoring (also from Addison-Wesley Professional), which provides step-by-step instructions for many refactorings.
Table of contents
Overview. Section 1: Smells within Classes. Section 2: Smells between Classes. Section 3: Programs to Refactor. A Word on the Challenges.
I. SMELLS WITHIN CLASSES.
2. The Refactoring Cycle.
What Is Refactoring? Smells Are Problems. The Refactoring Cycle. When Are We Done? Inside a Refactoring. Challenges. Conclusion.
3. Measured Smells.
Smells Covered. Comments. Long Method. Large Class. Long Parameter List. More Challenges. Conclusion.
Interlude 1. Smells and Refactorings.
Smells Covered. Type Embedded in Name (Including Hungarian). Uncommunicative Name. Inconsistent Names.
5. Unnecessary Complexity.
Smells Covered. Dead Code. Speculative Generality.
Interlude 2. Inverses.
Smells Covered. Magic Number. Duplicated Code. Alternative Classes with Different Interfaces. Challenges.
7. Conditional Logic.
Smells Covered. Null Check. Complicated Boolean Expression. Special Case. Simulated Inheritance (Switch Statement).
Interlude 3. Design Patterns.
II. SMELLS BETWEEN CLASSES.
Smells Covered. Primitive Obsession. Data Class. Data Clump. Temporary Field.
Smells Covered. Refused Bequest. Inappropriate Intimacy (Subclass Form). Lazy Class.
Smells Covered. Feature Envy. Inappropriate Intimacy (General Form). Message Chains. Middle Man. Challenges.
11. Accommodating Change.
Smells Covered. Divergent Change. Shotgun Surgery. Parallel Inheritance Hierarchies. Combinatorial Explosion.
12. Library Classes.
Smells Covered. Incomplete Library Class. Challenges.
Interlude 4. Gen-A-Refactoring.
III. PROGRAMS TO REFACTOR.
13. A Database Example.
Course.java (Online at www.xp123.com/rwb). Offering.java. Schedule.java. Report.java. TestSchedule.java. TestReport.java.
14. A Simple Game.
Introduction. Path 1: Catalog.itemsMatching(query). Path 2: Query.matchesIn(catalog). Path 3: Process(catalog.data, query.data). Conclusion.
16. Planning Game Simulator.
Part 1: Original Code. Part 2: Redistributing Features. Removing Duplication, Selection Troubles, and a Few Burrs. Part 3: Pushing the Code Further.
17. Where to Go from Here.
Books. Admonitions. Exercises to Try. Web Sites.
A: Answers to Selected Questions.
B: Java Refactoring Tools.
C: Inverses for Refactorings.
D: Key Refactorings.
About Ross Venables