Moving Features Between Objects

Placing responsibilities in the correct classes.

Table of Contents

  • Move Method: Move a method to the class that uses it most.
  • Move Field: Move a field to the class that uses it most.
  • Extract Class: Move the relevant fields and methods to a new class.
  • Inline Class: Move a class’s features into another class and remove it.
  • Hide Delegate: create a method in the client class that calls the delegate object.
  • Remove Middle Man: Force the client to call the delegate directly.