Cohesion and Coupling in software Design

20:56 Prashant Roy 0 Comments

Cohesion and Coupling  in Sostware Design


Cohesion:

"Cohesion is a natural extension of the information hiding concept."A cohesive module performs a single task within a software procedure,reqiring little interaction with procedures being performed in other parts of a program.The internal cohesionof a module is measured in terms of the strength of binding of elements within the module.
Cohesion of elements occurs on the scale in following order:
    1. coincidental cohesion:It occurs when the elements within a module have no apparent relationship to one another.
    2. Logical cohesion:It imples some relationship among the elements of the modules.These module usually require further decomposition.
    3. Temporal module:Module with temporal cohesion shows many of the some disadvantages as legally bound modules.However they are higher on the scale of binding because all elements are executed at one time and no parameter or logic are required to determine which elements to execute.
    4. Communication cohesion:Communication cohesion refer to the same set of input and/or output data.ex-Print and punch the output.
    5. Sequential cohesion:Sequential cohesion occurs when output of one element is the input of next element .
    6. Functional cohesion:In a fuctional cohesion, all elements are related to the performance of a single function. It is strong and hence desirable, type of binding of elements.
    7. Information cohesion:Information cohesion occurs when the module contains a complex data structure and several routines to manipulated the data structure.

Coupling:

"Coupling is a measure of interconnection among modules in a software structure". Coupling depends on the interface complexity between modules,the point at which reference is made to a modules and what data pass across the interface.
Note:In software design, we try hard for lowest possible coupling.
There are mainly three types of couling which occurs in software design:
  1. Low coupling/Data coupling:When one-to-one correspondance of items exists caleed low/data coupling.
  2. Stam coupling:A variation of data coupling called stamp coupling.
  3. Content coupling:The highest degree of coupling is called content coupling. It occurs when one modules makes use of data or control information maintained within the boundary of another module.Secondly, content couling occurs when branches are made into the middle of the module.
cohesion-coupling-image


0 comments: