CSC/ECE 517 Fall 2009/wiki1a 8 nd: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 120: Line 120:


*'''Refactoring for Privacy'''
*'''Refactoring for Privacy'''
**Hide Delegate
**Hide Delegate
**Hide Method
**Hide Method
Line 131: Line 130:


*'''Dealing with Exceptions'''
*'''Dealing with Exceptions'''
**Remove Error Code with Exception
**Remove Error Code with Exception
**Replace Exception with Test
**Replace Exception with Test


----
----

Revision as of 00:39, 5 September 2009

Categorization of Refactorings

Problem Statement : The list of refactorings has become quite long. But people don't remember long lists very well. To promote learning the different patterns, they should be categorized in some way, or perhaps, along various dimensions. As a reference we have taken the list of refactorings available here and categorized them along as many different dimensions as makes sense.

  • Package
    • Extract Package
    • Move Class

  • Class
    • Changing Class Association
      • Change Unidirectional Association to Bidirectional
      • Change Unidirectional Association to Bidirectional
    • Change of Class Structure
      • Collapse Hierarchy
      • Duplicate Observed Data
      • Extract Class
      • Extract SubClass
      • Extract SuperClass
      • Inline Class
      • Replace Subclass with Fields
      • Separate Data Access Code
    • Addition to a Class
      • Pull up Constructor Body
      • Pull up Field
      • Pull up Method
      • Push Down Field
      • Push Down Method

  • Method
    • Meaningful and Detailed Method Calls
      • Add Parameter
      • Rename Method
      • Preserve Whole Object
    • Change of Structure of the Method Code
      • Extract Method
      • Inline Method
      • Consolidate Conditional Expression
      • Encapsulation Collection
      • Form Template Method
      • Replace Nested Conditional with Guard Clauses
      • Replace Parameter with Method
    • Change Method Call Hierarchy
      • Remove Middle man
      • Replace Delegation with Inheritance
      • Replace Inheritance with Delegation
    • Improve Method Readability
      • Introduce Explaining Variable
      • Replace Magic No with Symbolic Constant
      • Split Temporary Variable
    • Method Code Refactoring based on Method Arguments
      • Replace Conditional with Polymorphism
      • Replace Conditional with Visitor
      • Replace Parameter with Explicit Methods

  • Object
    • Replacements with Objects
      • Introduce Null Object
      • Replace Array with Object
      • Introduce Parameter Object
      • Replace Data Value with Object
      • Replace Method with Method Object
    • Object Initialization
      • Replace Constructor with Factory Method
    • Accessing the Object/Data
      • Change Reference to Value
      • Change Value to Reference
      • Refactor Architecture by Tiers
      • Self Encapsulate Field

  • Code
    • Code Optimization
      • Replace Temp with Query
      • Consolidate Duplicate Conditional Fragments
      • Decompose Conditional
      • Inline Temp
      • Introduce Assertion
      • Replace Iteration with Recursion
      • Remove Control Flag
    • Redundant Code Elimination
      • Parametrize Method
      • Remove Parameter
    • Method Code Simplification
      • Remove Double Negative
      • Replace Assignment with Initialization
      • Encapsulate Downcast
      • Reduce Scope of Variable
      • Reverse Conditional
      • Separate Query from Modifier
      • Split Loop
      • Substitute Algorithm
    • "Removal of "Type Code"
      • Replace Type Code with Class
      • Replace Type Code with State/Strategy
      • Replace Type Code with Subclasses

  • Refactoring for Privacy
    • Hide Delegate
    • Hide Method
    • Encapsulate Field
    • Hide Presentation Tier-Specific Details from the Business tier
    • Introduce Business Delegate
    • Wrap Entities with Session

  • Dealing with Exceptions
    • Remove Error Code with Exception
    • Replace Exception with Test