Refactoring-Improving the Design of Existing Code——学习笔记(7)
Chapter 12 Big Refactorings
(1)Tease Apart Inheritance
You have aninheritance hierarchy that is doing two jobs at once. Create two hierarchiesand use delegation to invoke one from the other.
(2)Convert Procedural Design to Objects
You have codewritten in a procedural style. Turn the data records into objects, break up thebehavior, and move the behavior to the objects.
(3)Separate Domain from Presentation
You have GUIclasses that contain domain logic. Separate the domain logic into separatedomain classes.
(4)Extract Hierarchy
You have a classthat is doing too much work, at least in part through many conditionalstatements. Create a hierarchy of classes in which each subclass represents aspecial case.