These are abbreviated notes taken from Martin Fowler's Refactoring.
(This is an atomic refactoring.)
(This is an atomic refactoring.)
- Copy the function and rename as query
- Remove side effects from query
- Replace each call using return value with call to query plus call to modifier
- Remove return value from original function
- Extract Function on code to be replaced
- Add tests for the new function
- Replace the function body
- Create the function
- Copy the extracted code into the body
- Add parameters for non-local references
- Replace Inline Code with Function Call on the source function
- Replace call with function body (repeating for each call)
- Remove function definition
- Extract Function on body (i.e. delegate from source function)
- Change the signature of the extracted function
- Inline Function to remove source function
- Rename Function to replace source function (this refactoring, simple mechanics)
- Copy function to target context
- Replace Inline Code with Function Call to delegate from source function
- Inline Function to remove source function
- Extract Function on first caller
- Replace Inline Code with Function Call on remaining callers
- Inline Function to remove source function
- Rename Function to replace source function
- Extract Function on body without the statement
- Inline Function on source function
- Rename Function to replace source function
- Create an empty function with the desired signature
- Delegate to the source function
- Replace each call to the source function with a call to the target function
- Inline Function to remove source function
- Rename Function to replace source function
- This is a form of Extract Function
- Create an empty function with the desired signature
- Delegate to the constructor
- Replace each call to the constructor with a call to the factory function
- Create functions to read and update the variable
- Replace Inline Code with Function Call to replace each variable reference
- Restrict the visibility of the variable
- Encapsulate Variable on the record variable
- Create a class wrapping the record, with a record accessor
- Use the object in the variable (use the record accessor in the encapsulating functions)
- Extract Function to create an object accessor
- Inline Function to use the object accessor in client code
- Extract Function to create accessors for fields from client code
- Remove Function on the record accessor
- Remove Function on the encapsulating functions
- Encapsulate Record to create the class
- Move Function on each function
- Extract Function on data manipulation code