Search code examples
design-patternsooparchitecturen-tier-architecture

Does n tier architecture break OO concept of encapsulation


I have an n tier application with presentation layer, business layer, DAL and business objects layer. Separating the objects and the operation written on the objects break the object oriented concept of encapsulation.


Solution

  • No. Consider what "encapsulation" means: the implementation details of a class are concealed behind the interface (messages, or methods) of the class.

    In fact, you can derive the n-tier architecture directly from OO principles and Parnas's Law: a module should encapsulate what's likely to change. The presentation tier encapsulates the details of creating a "visible" interface; the middle tier the model of the business itself; and the back end the details of accessing the persistent data store.