Dive into Design Patterns

Identify the aspects of your application that vary and separate them from what stays the same.

  • The ability of an object to hide parts of its state and behaviours from other objects, exposing only a limited interface to the rest of the program
  • To encapsulate something means to make it private and only accessible from within methods of its own class.
    • You can isolate the parts of the program that vary in independent modules, protecting the rest of the code from adverse effects
  • The goal of encapsulation is to minimise the effect caused by changes
  • Interfaces and Abstract Classes/Abstract Methods are based on the concepts of abstraction and encapsulation.