October 2009
Intermediate to advanced
480 pages
9h 59m
English
Generalization produces its own batch of refactorings, mostly dealing with moving methods around a hierarchy of inheritance, or a module hierarchy. Pull Up Method and Push Down Method promote function up and down a hierarchy, respectively. Rather than pushing down a constructor, it is often useful to use Replace Constructor with Factory Method.
If you have methods that have a similar outline body but vary in details, you can use Form Template Method to separate the differences from the similarities.
In addition to moving functionality around a hierarchy, you can change the hierarchy by creating new classes or modules. Extract Module, Extract Subclass, and Introduce Inheritance all do this by forming new ...
Read now
Unlock full access