(Previous: (1.4.3) Module)

So, the concept of modules was born to limit the interaction between source code. The programming language Modula is designed by Niklaus Wirth (*1) around 1975. This language was based on Pascal and introduced the concept of modules.

In Modula, the module was a group of strongly related codes. We can not access the components in the module from outside the module without explicitly “exporting.” We can not access the components outside of the module from inside the module without explicit “importing”. In other words, the module in the programming language shows only a part of its contents outside and does not show the rest.

image

What you show outside is an important part to use that module as a component of programs. Consider, for example, a component “list” that can contain any number of values. To use it, you need functions such as “add one value to the list” and “get the N-th value of the list.” So those functions should be exported. On the other hand, the specific implementation details, such as how we store the values in memory, are not important for the user of this module. So we can hide them.

Related: Mediator Pattern

en.icon