Refactoring for Encapsulation/Information Hiding

Main refactorings:

  • Move Field
  • Move Method
  • Hide Method
  • Encapsulate Downcast
  • Encapsulate Field
  • Encapsulate Collection
  • Hide Delegate
  • Self-Encapsulate Field

Book example: CardManager class has method updateLimit() which has direct access to an instance variable in Card class. Hiding the instance variable and providing setters and getters within Card would be a valuable refactoring.