Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Refactoring/BigRefactorings: Difference between revisions

From ZeroWiki
(Repair MoniWiki formatting after migration)
(Repair batch-0003 pages from live compare)
 
Line 14: Line 14:
http://zeropage.org/~reset/zb/data/ExtractHierarchy.gif   
http://zeropage.org/~reset/zb/data/ExtractHierarchy.gif   
----
----
[[Refactoring]]
Refactoring

Latest revision as of 00:29, 27 March 2026

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


Refactoring