Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
This chapter is from the book


    Q Isn't there a standard that dictates how to encapsulate?

    A The quick answer is no. Encapsulation is facilitated by object-oriented development. You can write an application with objects and classes that don't really encapsulate much of anything. It's up to the class designer to encapsulate functionality and data into a "black box" that users can easily use without knowing the internal implementation.

    Q Can I go too far with encapsulation?

    A Yes. If you take encapsulation too far, a class becomes rigid and useful only for its original purpose. Rigid classes don't provide a flexible enough interface to allow new classes to inherit and enhance its functionality. Also, the interface is too rigid for its intended use because it evolves and is constantly being changed to accommodate new requirements. Encapsulation is a good thing, but too much can be a bad thing.

  • + Share This
  • 🔖 Save To Your Account