Coupling and cohesion
From CSSEMediaWiki
(Difference between revisions)
(→Coupling) |
(→Coupling) |
||
Line 4: | Line 4: | ||
From {{Ref|1}}: | From {{Ref|1}}: | ||
<blockquote> | <blockquote> | ||
− | The fewer and simpler the connections between modules, the easier it is to understand each module without reference to other modules. Minimizing connections between modules also minimizes the paths along which changes and errors can propagate into other parts of the system, thus eliminating disastrous "ripple" effects, where changes in one part cause errors in another, necessitating | + | The fewer and simpler the connections between modules, the easier it is to understand each module without reference to other modules. Minimizing connections between modules also minimizes the paths along which changes and errors can propagate into other parts of the system, thus eliminating disastrous "ripple" effects, where changes in one part cause errors in another, necessitating additional changes elsewhere, giving rise to new errors, etc. |
</blockquote> | </blockquote> | ||
Revision as of 09:50, 14 September 2008
First described in [1], coupling and cohesion refers to structuring a set of "highly cohesive classes and to maintain loose coupling between those classes. High-cohesion means well-structured classes and loose coupling means more flexible, extensible software" [2]
Contents |
Coupling
From [1]:
The fewer and simpler the connections between modules, the easier it is to understand each module without reference to other modules. Minimizing connections between modules also minimizes the paths along which changes and errors can propagate into other parts of the system, thus eliminating disastrous "ripple" effects, where changes in one part cause errors in another, necessitating additional changes elsewhere, giving rise to new errors, etc.
Cohesion
From [1]:
Coupling is reduced when the relationships among elements not in the same module are minimized. There are two ways of achieving this - minimizing the relationships among modules and maximizing relationships among elements in the same module. In practice, both ways are used.
The second method is [in effect, increasing cohesion between elements]. "Element" in this sense means any form of a "piece" of the module, such as a statement, a segment, or a "subfunction". Binding is the measure of cohesiveness of a module. The objective here is to reduce coupling by striving for high binding.
References
- ^W. Stevens, G. Myers, L. Constantine, "Structured Design", IBM Systems Journal, 13 (2), 115-139, 1974.
- ^ http://javaboutique.internet.com/tutorials/coupcoh/
External Links
- Read [1] at IBM Research