2.4 Why modelling and encapsulation matter
Both abstraction as modelling and abstraction as encapsulation allow us to manage complexity:
- In the case of modelling, this is done by discarding information: we abstract away all that is irrelevant, to leave a model that contains only what is actually of interest.
- In the case of encapsulation it is done by hiding information: we encapsulate the details of an implementation/automation (of a model) behind an interface.
These strategies are utterly essential to all computer modelling. Without modelling we would be swamped by the complexity of the real world and it would be impossible to define the problem precisely enough to allow it to be solved using an algorithm. Without encapsulation we would be swamped by the detail of the ‘computer world’ and would find it impossible to deal with the complexity required to implement algorithms as computer programs.
Activity 5 Modelling and encapsulation
In answer to Activity 2 you were asked to construct the diagram in Figure 18. Describe where modelling and encapsulation fit into this diagram.
Modelling is involved when one creates an abstraction for a physical-world phenomenon. Modelling results in a mathematical model which can then be automated. To deal with the complexity of automating a model, one can use encapsulation.