Created October 11, 2009
Last updated October 11, 2009
[ Japanese | English ]

Object-oriented and the Module Cohesion and the Module Coupling

  In this page, I will explain the relationship the object-oriented and the "Module Cohesion" and the "Module Coupling".

  If you study the object-oriented, you should understand the Module Cohesion and the Module Coupling. But, there are few books that explains them.

  The Module Cohesion and the Module Coupling are the range of Development Engineer (Japan Information-Technology Engineers Examination) and UMTP L3. If you acquire those qualifications , you should study them.


1. What is the Module Cohesion?
2. What is the Module Coupling?
3. Object-oriented and the Module Cohesion and the Module Coupling
4. Reference


1. What is the Module Cohesion?

  The Module Cohesion (Table 1) means the strength of relation of component of the module ( class ).

Table 1 - Types of Module Cohesion

Independency

Cohesion

Type

Descliption

high low(bad) Coincidental cohesion The module of this cohesion is simply divided the program. You can't define functions in the module. Or the module has two or more functions , but these functions are not related at all.
    Logical cohesion The module of this cohesion is collected two or more related functions. By the argument (functional code) when module is called , the function in the module is selected and executed.
    Temporal cohesion For instance, initializing function or finalizing function. The module of this cohesion is collected functions executed at specific time. Functions in module are not related.
    Procedural cohesion The module of this cohesion is collected two or more functions executed one after another.
    Communicational cohesion If the module is the Procedural cohesion , and functions in the moudle is related to the data.
    Sequential cohesion The module of this cohesion is collected the same data structure or resource. And each function, this module has entry or exit points.
low high(good) functional cohesion The module of this cohesion has only one function.



  Cohesion (computer science) - Wikipedia, the free encyclopedia explains details.

  When you design the software, you should design to become high cohesion (if object-oriented, Sequential cohesion).
  But, for all classes, I think that you can't design to become high cohesion.
  Because, I think that we frequently design the temporal cohesion classes.

  Incidently, I think that entity classes are the Sequential cohesion.
Back to Top

2. What is the Module Coupling?

  The Module Coupling (Table 2) means the strength of relation of between modules ( classes ).

Table 2 - Types of Module Coupling

Independency

Coupling

Type

Descliption

low high(bad) Content coupling When the class refers to other class by absolute address , or directly jumps to other class.
    Common coupling When classes refer to the common global data.
    External coupling When necessary datas are only externaly defined. And other classes are allowed to refer to those datas.
    Control coupling For instance, functional code, the element controled the module is given to other module by the argument , and the function is executed. This coupling is equal to The Logical cohesion of the Module Cohesion.
    Stamp coupling In the used module, even if a part of the struct data (record) is only used, the data type of the argument is struct ( or class ).
high low(good) Data coupling You treat the target module as the blackbox, the necessary data is only given to the target module.


  Coupling (computer science) - Wikipedia, the free encyclopedia explains details.

  When you design the software, you should design to become low coupling.
  if object-oriented, I think that the Stamp coupling or the Data coupling is best. The Stamp coupling is lower than the Data coupling. But when you design to become the Data coupling , arguments of the method are increased and the program code become difficult to read.
  Then, for all between classes, I think that you can't design to become low coupling.
Back to Top

3. Object-oriented and the Module Cohesion and the Module Coupling

  If you design by the object-oriented, I think that you should design the high cohesion and the low coupling as much as possible 1.
  At least, when those are the recycled class. When those are not the recycled class , I think that you don't need to consider the cohesion and the coupling.
(The reason of "you don't need to consider" is that the time , cost and so on is increased. )

---------
Note.
1:You can not always do so.
The high cohesion or the low coupling are high quality program.
But, the quality of the program is included the time efficiency, the security 2 and so no besides the cohesion and the coupling.
For example, even if the program is the high cohesion , when this is slowly , this is useless.

2:The software quality is defined ISO/IEC9126 (JIS X 0129). And the quality has 6 factors.
  1. functionality ( suitability, accuracy, interoperability, compliance, security )
  2. reliability ( maturity, fault tolerance, recoverability )
  3. usability ( understandability, learnability, operability )
  4. efficiency ( time behaviour, resource behaviour )
  5. maintainability ( analyzability, changeability, stability, testability )
  6. portability ( adaptability, installability, compliance, replaceability )
Software quality - Wikipedia, the free encyclopedia explains detail.
The software quality is range of the Project Manager Examination of Development Engineer (Japan Information-Technology Engineers Examination).
If you acquire this qualification , you should study them.

Back to Top

4. Reference

  The following tables are pages that I referred to create this page.

No.

Linked Website Name

Description

Linked date

1

Cohesion (computer science) - Wikipedia, the free encyclopedia This website is written the Module Cohesion , and about the best cohesion. October 11, 2009

2

COMP 145: Module Cohesion This website is written the Module Cohesion , and explains about the best cohesion with the figure. October 11, 2009

3

Coupling (computer science) - Wikipedia, the free encyclopedia This website is written the Module Coupling , and about the best coupling. October 11, 2009

4

Software quality - Wikipedia, the free encyclopedia This website explains the quality of the software. October 11, 2009

5

GRASP (Object Oriented Design) - Wikipedia, the free encyclopedia GRASP pattern has the "Low Coupling" pattern and the "High Cohesion" pattern. October 11, 2009
Prev Up Next  Top
Back to Top

I doesn't assume the responsibility of any damage that occurs because of the use of this page.

Microsoft ,Windows ,Visual Basic and Excel are registered trademarks of Microsoft Corporation in the United States and other countries.
Visual BasicR for Applications may represent a VBA.
Mac ,Mac OS ,Mac OS X ,AppleScript are trademarks of Apple Inc., registerd in the U.S. and other countries.
Sun, Sun Microsystems, Sun Microsystems Computer Corporation, the Sun logo, the Sun Microsystems Computer Corporation logo, Solaris, Java, JavaSoft, JavaScript, HotJava, JDK, and all Java-based trademarks or logos are trademarks or registered trademarks of Sun Microsystems, Inc.
Other brands and their products are trademarks or registered trademarks of their respective holders and should be noted as such.

The author of this page and these companies do not have any relationship.