More actions
Chapter 12 Big Refactorings
Tease Apart Inheritance
- You have an inheritance hierarchy that is doing two jobs at once.
Create two hierarchies and use delegation to invoke one from the other.
http://zeropage.org/~reset/zb/data/TeaseApartInheritance.gif
Convert Procedural Design to Objects
- You have code written in a procedural style.
Turn the date records into objects, break up the behavior, and move the behavior to the objects.
http://zeropage.org/~reset/zb/data/ConvertProceduralDesignToObjects.gif
Separate Domain from Presentation
- You have GUI classes that contain domain logic.
Separate the domain logic into separate domain classes.
http://zeropage.org/~reset/zb/data/SeparateDomainFromPresentation.gif
Extract Hierarchy
- You have a class that is doing too much work, at least in part through many conditional statements.
Create a hierarchy of classes in which each subclass represents a special case.
http://zeropage.org/~reset/zb/data/ExtractHierarchy.gif