,inside front cover
Quick overview of refactoring patterns
EXTRACT METHOD (P3.2.1)—Takes part of one method
and extracts it into its own method.
REPLACE TYPE CODE WITH CLASSES (P4.1.3)—
Transforms an enum into an interface, and the enums’ values
become classes.
PUSH CODE INTO CLASSES (P4.1.5)—Is a natural
continuation of REPLACE TYPE CODE WITH CLASSES
(P4.1.3), as it moves functionality into classes.
INLINE METHOD (P4.1.7)—Removes methods that no
longer add readability to our program.
SPECIALIZE METHOD (P4.2.2)—Removes unnecessary
and problematic generality from methods.
TRY DELETE THEN COMPILE (P4.5.1)—Removes
unused methods from interfaces and classes when we know
their entire scope.
UNIFY SIMILAR CLASSES (P5.1.1)—Unifies two or more
classes that differ from each other in a set of constant methods.
COMBINE ifS (P5.2.1)—Reduces duplication by joining
consecutive ifs that have identical bodies.
INTRODUCE STRATEGY PATTERN (P5.4.2)—Replaces
variance through if by instead instantiating classes.
EXTRACT INTERFACE FROM IMPLEMENTATION
(P5.4.4)—Replaces dependencies on a class with an interface.
,ELIMINATE GETTER OR SETTER (P6.1.3)—Eliminates
getters and setters by moving the functionality closer to the
data.
ENCAPSULATE DATA (P6.2.3)—Localizes invariants
related to variables and makes cohesion clearer.
ENFORCE SEQUENCE (P6.4.1)—Makes the compiler
guarantee things happen in a specific order.
,
Quick overview of refactoring patterns
EXTRACT METHOD (P3.2.1)—Takes part of one method
and extracts it into its own method.
REPLACE TYPE CODE WITH CLASSES (P4.1.3)—
Transforms an enum into an interface, and the enums’ values
become classes.
PUSH CODE INTO CLASSES (P4.1.5)—Is a natural
continuation of REPLACE TYPE CODE WITH CLASSES
(P4.1.3), as it moves functionality into classes.
INLINE METHOD (P4.1.7)—Removes methods that no
longer add readability to our program.
SPECIALIZE METHOD (P4.2.2)—Removes unnecessary
and problematic generality from methods.
TRY DELETE THEN COMPILE (P4.5.1)—Removes
unused methods from interfaces and classes when we know
their entire scope.
UNIFY SIMILAR CLASSES (P5.1.1)—Unifies two or more
classes that differ from each other in a set of constant methods.
COMBINE ifS (P5.2.1)—Reduces duplication by joining
consecutive ifs that have identical bodies.
INTRODUCE STRATEGY PATTERN (P5.4.2)—Replaces
variance through if by instead instantiating classes.
EXTRACT INTERFACE FROM IMPLEMENTATION
(P5.4.4)—Replaces dependencies on a class with an interface.
,ELIMINATE GETTER OR SETTER (P6.1.3)—Eliminates
getters and setters by moving the functionality closer to the
data.
ENCAPSULATE DATA (P6.2.3)—Localizes invariants
related to variables and makes cohesion clearer.
ENFORCE SEQUENCE (P6.4.1)—Makes the compiler
guarantee things happen in a specific order.
,