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

From Expertiza_Wiki
Jump to navigation Jump to search
Line 13: Line 13:
From worst to best, the types of cohesion are listed below:
From worst to best, the types of cohesion are listed below:
<pre>
<pre>
Coincidental Cohesion (Worst)
Coincidental Cohesion (worst)
Logical Cohesion
Logical Cohesion
Temporal Cohesion
Temporal Cohesion
Line 20: Line 20:
Sequential Cohesion
Sequential Cohesion
Functional Cohesion
Functional Cohesion
Informational Cohension (Bad)
Informational Cohension (best)
</pre>
</pre>


==== Coincidental Cohesion(Worst) ====
==== Coincidental Cohesion (worst) ====
Coincidental cohesion means the module are grouped randomly, without significant relationshiop. Example,
Coincidental cohesion means the module are grouped randomly, without significant relationshiop. Example,
<pre>
<pre>

Revision as of 04:34, 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.

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)
Logical Cohesion
Temporal Cohesion
Procedual Cohesion
Communicational Cohesion
Sequential Cohesion
Functional Cohesion
Informational Cohension (best)

Coincidental Cohesion (worst)

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

module miscellaneous
  sin();
  read();
  sendsignal();
  ...
end

Logical Cohesion

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

module IOfunction
  printf();
  read_A;
  write_B;
end

Temporal Cohesion

The elements of the module are related in time

Examples

Cohesion Metrics

Coupling

Types of Coupling

Examples

Coupling Metrics

Reference

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

External Links