a software system is divided into modules such as classes in an object-oriented language the modules are designed to be relatively independent of each other so that a programmer can work on the module without having to understand the details of other modules.
in modular design, a software system is decomposed into a collection of modules that are relatively independent. Modules can take many forms, such as classes subsystems, or services, In an ideal world each module would be completely independent of the others a developer could work in any of the modules without knowing anything about any of the other modules. In this world, the complexity of the system would be the complexity of its worst module. unfortunately, this ideal is not achievable, modules must work together by calling each other’s functions or methods. As a result, modules must know something about each other there will be dependencies between the modules if one module changes other modules may need to change to match The goal of modular design is to minimize the dependencies between modules as Dependencies can take many other forms and can be quite subtle, in order to manage dependencies, we think of each module in two parts an interface and an implementation.
POSD - module interface
A Module Interface consists of everything that a developer working in a different module must know in order to use the given module. Typically the interface describes what the module does but not how it does it.
The interface to a module contains two kinds of information
- formal: the formal part of an interface is specified explicitly in the code, and some of these can be checked for correctness by the programming language. for example, the formal interface for a method is its signature. interface for a class consists of the signatures for all of its public methods, plus the names and the types of any public variables.
- informal: each interface also includes informal elements that are not specified in the way of an interface including its high-level behavior, such as the fact that a function deletes the fine named by one of its arguments. if there are constraints on the usage of a class these are also part of the class interface. In most interfaces, the informal aspects are larger and more complex than the formal aspects. One of the benefits of a clearly specified interface is that it. indicates exactly what developers need to know in order to use the associated module this helps to eliminate the unknown unknowns
module implementation
A Module Implementation consists of the code that carries out the promises made by the interface
Link to original