Header Ads Widget

Coupling and Cohesion Measures

Coupling  and  Cohesion Measures:

Cohesion is a measure that defines the degree of intra-dependability within elements of a module. The greater the cohesion, the better is the program design.

Cohesion is a measure that defines the degree of intra-dependability within elements of a module. The greater the cohesion, the better is the program design.“The measure of the strength of functional relatedness of elements within a module”. Cohesion refers to the dependence within and among a module’s internal elements”

There are seven types of cohesion, namely –

  • Coincidental cohesion - It is unplanned and random cohesion, which might be the result of breaking the program into smaller modules for the sake of modularization. Because it is unplanned, it may serve confusion to the programmers and is generally not-accepted.
  • Logical cohesion - When logically categorized elements are put together into a module, it is called logical cohesion.A module has logical cohesion when it performs a series of related actions, one of which is selected by the calling module
  • Temporal Cohesion - When elements of a module are organized such that they are processed at a similar point in time, it is called temporal cohesion.A module has temporal cohesion when it •performs a series of actions related in time 
  • Procedural cohesion - When elements of a module are grouped together, which are executed sequentially in order to perform a task, it is called procedural cohesion.
  • Communicational cohesion - When elements of a module are grouped together, which are executed sequentially and work on the same data (information), it is called communicational cohesion.A module has communicational cohesion if it performs a series of actions related by the procedure to be followed by the product, but in addition all the actions operate on the same data
  • Sequential cohesion - When elements of a module are grouped because the output of one element serves as input to another and so on, it is called sequential cohesion.
  • Functional cohesion - It is considered to be the highest degree of cohesion, and it is highly expected. Elements of modules in functional cohesion are grouped because they all contribute to a single well-defined function. It can also be reused.

Coupling is a measure that defines the level of inter-dependability among modules of a program.

  •  It tells at what level the modules interfere and interact with each other. The lower the coupling, the better the program.
  • The degree of interdependence between two modules”
  • Coupling is a measure that defines the level of inter- dependability among modules of a program. It tells at what level the modules interfere and interact with each other. The lower the coupling, the better the program.
  • Coupling is the measure of the interdependence of one module to another. Modules should have low coupling.
  • Low coupling minimizes the "ripple effect" where changes in one module cause errors in other modules

There are five levels of coupling, namely -

  • Content coupling - When a module can directly access or modify or refer to the content of another module, it is called content level coupling.
  • Common coupling- When multiple modules have read and write access to some global data, it is called common or global coupling.
  • Control coupling- Two modules are called control-coupled if one of them decides the function of the other module or changes its flow of execution.
  • Stamp coupling- When multiple modules share a common data structure and work on different parts of it, it is called stamp coupling.
  • Data coupling- Data coupling is when two modules interact with each other by means of passing data (as parameter). If a module passes data structure as parameter, then the receiving module should use all its components.Ideally, no coupling is considered to be the best

Post a Comment

0 Comments