CSC/ECE 517 Summer 2008/wiki3 3 cd
Problem Statement
We introduced the idea of low coupling in Lecture 20, and used the Observer pattern as an example in Lecture 23. But we've really only scratched the surface on what there is to know about achieving low coupling. Browse the Web and the ACM DL for other information, both theoretical and practical, and produce a guide to what there is to know about low coupling. Be sure to highlight those aspects that would be appropriate for inclusion in CSC/ECE 517.
Low coupling.
Coupling in Software Design can be either High or Low. What this means is that object and classes in your code can exist indepently of other objects or classes. Coupling between modules/components is their degree of mutual interdependence. For example a system that has high coupling might experience the following issues:
- Change in one module forces a ripple of changes in other modules.
- Modules are difficult to understand in isolation.
- Modules are difficult to reuse or test because dependent modules must be included.
Examples of low coupling include.
- size: low number of connections between routines
- intimacy: minimal number of connections between routines
- visibility: the prominence of the connection between routines
- flexibility: the ease of changing the connections between routines
Coupling in Theory
Coupling level names are presented in order from worse to better: (high coupling is bad)
- Content/Pathological Coupling : (worst) When a module uses/alters data in another
- Control Coupling : 2 modules communicating with a control flag (first tells second what to do via flag)
- Common/Global-data Coupling : 2 modules communicating via global data
- Stamp/Data-structure Coupling : Communicating via a data structure passed as a parameter. The data structure holds more information than the recipient needs.
- Data Coupling : (best) Communicating via parameter passing. The parameters passed are only those that the recipient needs.
- No data coupling : independent modules.
Coupling in Practice
http://www.leansoftwareengineering.com/wp-content/uploads/2007/08/abc.jpg
Coupling is easy to measure and understand because it is mechanical in nature and requires less interpretation. Suppose there are three components A, B, and C. A's behavior depends upon B in some way (any way), A’s behavior depends upon C in some way, and the behavior of B and C do not appear to depend upon anything else.
That is the coupling of the system and it is measureable.