definition of a module
- a single piece of compiled code
examples of modules
*.EXE
*.DLL
*.JAR
what a typical module looks like:
- code/data
- location
- reference list (what other modules does it point
to)
- entry points for other modules to link in to
how many modules per program
- a single program might consist of hundreds of
modules
modules might have only data in them
two reasons why they exist:
- easy maintenance
- program fits into a smaller amount of memory
This provides for easy maintenance, because it is necessary to recompile only the altered module, as opposed to the entire program, when updates to the source are made. It also allows a program to fit into a smaller amount of memory because the modules can be swapped in and out of memory as needed.
Dynamic Linking enables one to store separately compiled modules (or shared libraries, or class-handlers or DLL's) in files on disk and maintain them separately, meaning that in principle one can be compiled without recompiling all the others.
Alos, because of separate compilation, A has no idea that B references C, providing a form of information hiding and ultimately portability.