CSC/ECE 517 Fall 2007/wiki2 7 b2: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 30: Line 30:


== Reference ==
== Reference ==
<references/>
== External Links ==
== External Links ==

Revision as of 03:59, 21 October 2007

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. <ref name=Yourdon>Yourdon, E.; Constantine, L L. (1979). Structured Design: Fundamentals of a Discipline of Computer Program and Systems Design, copyright 1979 by Prentice-Hall, Yourdon Press</ref>

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 [1978b] 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

<references/>

External Links