10.2 Encapsulation


When building large programs, our enemy is complexity.

Some tools for managing complexity:

  • Hierarchical abstraction.

    • Create layers of abstraction, with clear abstraction barriers!

  • “Design for change” (D. Parnas)

    • Organize program around objects.

    • Let objects decide how things are done.

    • Hide information others don’t need.

Managing complexity is super important for large projects!

Modules and Encapsulation

Module: A set of methods that work together as a whole to perform some task or set of related tasks. A module is said to be encapsulated if its implementation is completely hidden, and it can be accessed only through a documented interface.

Last updated