读书人

Refactoring-Improving the Design of

发布时间: 2012-06-20 20:37:21 作者: rapoo

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.

Refactoring-Improving the Design of Existing Code——学习札记(7)

(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.

Refactoring-Improving the Design of Existing Code——学习札记(7)

(3)Separate Domain from Presentation

You have GUIclasses that contain domain logic. Separate the domain logic into separatedomain classes.

Refactoring-Improving the Design of Existing Code——学习札记(7)

(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.

Refactoring-Improving the Design of Existing Code——学习札记(7)

读书人网 >其他相关

热点推荐