CSC/ECE 517 Fall 2007/wiki2 7 b2

From Expertiza_Wiki
Revision as of 04:07, 21 October 2007 by Zchen3 (talk | contribs) (→‎Reference)
Jump to navigation Jump to search

Assignment 2 - Topic 7 - Cohesion and Coupling

Cohesion and coupling are concepts that are reasonably easy to understand, but nonetheless, it is challenging to find good examples that are succinct. Browse the hundreds of Web pages that attempt to explain these concepts, picking your favorite examples. Many of these pages mention related concepts; list some of them and explain how they relate to cohesion and coupling. Be sure to mention the metrics that can be used to measure how well a program conforms to the principles of high cohesion and low coupling.

The Concepts

The object-oriented paradigm, the virtuals of readability, maintainability, extensibility, reusability are realized through modularity, which aims at decomposing a complex problem into smaller pieces called modules (e.g. class). A module can be understood as a contiguous program statements, bounded together, having a set of its own variable names and an aggretate identifer.

Well designed object-oriented programs defines proper logic and operational boundaries among different modules, through which many aforementioned desiable properties can be achieved. The degree of interaction within one module was quantified and called module cohesion by Myers in 1978 and the degree of interaction between two different modules was called module coupling. It is considered as good traits when a program has high level cohesion while a low level coupling.

Cohesion

Types of Cohesion

From worst to best, the types of cohesion are listed below:

Coincidental Cohesion(Worst)

Coincidental cohesion means the module are grouped randomly, without significant relationshiop.

Logical Cohesion

A logical cohesion module is one whose elements are somewhat in the same category.

Examples

Cohesion Metrics

Coupling

Types of Coupling

Examples

Coupling Metrics

Reference

  • e. Yourdon, Modern Structured Analysis, Yourdon Press, Englewood Cliffs, NJ, 1989.

External Links