Encapsulation

Encapsulation means to cover or surround something in order to show or express the main idea or quality of it in a concise fashion.1 Encapsulation is a central part of modeling and designing systems in that it enables abstraction. Through encapsulation, the internal workings of any component part of a system can be concealed in order for it to reveal only the most essential properties and functionality required for its interaction with other components. In such a way encapsulation abstracts away the internal detail and complexity of a subsystem to enable the effective designing, functioning or vision of the whole system.
Within systems design and modeling encapsulation enables a few key factors that are essential to the modeling of large and complex systems. Firstly it allows abstraction through what is called black boxing. Secondly, it enables the containment of interrelated elements and functions, restricting access to them and protecting them from outside interference.

Black Boxing

Through encapsulation, the inner workings to a subsystem are concealed or closed off from exposure to the functioning of other components. This is what is called black boxing where we close off the inner workings of a system, except those few piece that we decide to make public so that other elements can interact with it. A black box is a device, system or object which can be viewed in terms of its inputs and outputs, without any knowledge of its internal workings.2 Think of using a telephone, one wants the usage of the phone to be as simple as possible, we want to be able to just input the number and start talking. One does not care about the inner workings of the phone, the inner workings of the phone could completely change and it would not matter as long as one still had the same buttons to press and one can talk through it; this is an example of a black box. In A General Black Box Theory, Mario Bunge describes black box modeling as such: “The constitution and structure of the box are altogether irrelevant to the approach under consideration, which is purely external or phenomenological. In other words, only the behavior of the system will be accounted for.”3

White Box

Mathematical modeling problems are often classified into black box or white box models, according to how much a priori information on the system is available. A white box model – also called glass box or clear box – is a system whose internal workings can be view and where all necessary information is available. Practically all systems are somewhere between the black box and white box models.4 The difference between a white and black box model can be seen as a difference in levels of abstraction, in that a white box model will offer all concrete detail to the components internal workings while a black box abstracts away from these details.

Complexity

In general, model encapsulation through abstraction involves a trade-off between simplicity and accuracy of the model. For example, when modeling the flight of an aircraft, we could embed each mechanical part of the aircraft into our model and would thus acquire an almost white-box model of the system. However, the computational cost of adding such a huge amount of detail would effectively inhibit the usage of such a model. In our daily lives, we are confronted at every turn with systems whose internal mechanisms are not fully open to our inspection. Such as the car we drive, the process through which an article we read in the newspaper was created, how a butterfly manages to fly and so on. We view all of these everyday phenomena as black boxes; where we simply see the inputs and outputs, not the internal workings.5 It is only in this fashion that we can hope to deal with the vast complexity of the world that surrounds us is any functional manner.

Binding

Beyond abstraction, through black boxing, encapsulation also serves the function of binding. Encapsulation is designed to wrap a logically interrelated set of elements into a coherent subsystem. Encapsulation creates a boundary around some set of elements thus enabling the preservation of their structured interrelation and assures limited interference from other elements external to the module.
A closely related concept is that of information hiding. Information hiding is a principle in software development that holds that an encapsulated object should not reveal anything about itself except what is necessary for other parts of the application to work. For example, if one were building a banking application and had an encapsulated object for an account we would not want any other element in the system to be able to reach in and affect the balance to that account. Binding through encapsulation helps to define subsystems and enables separation of concerns. That is to say, it encapsulates a particular topic or concern within some subsystem to the model and defines clearly how that relates to other concerns within the overall system. As such, encapsulation and binding are a central design pattern to modularity within a model. They help to differentiate between different components within the larger system, reduce dependencies and interference and clearly define interrelationships.

2018-06-19T20:27:53+00:00