Machine-translated by Google. Questions are authored in English.
Top

Discussion

In object-oriented analysis, what is cohesion ?

  • A.Degree of interaction between modules
  • B.Degree to which elements within a module belong together
  • C.Number of classes in a system
  • D.Inheritance hierarchy depth

Answer: B

Cohesion is the degree to which elements within a module belong together.

A highly cohesive module or class does one well-defined job, and all its methods and data serve that job. Good design aims for high cohesion together with low coupling, because cohesive modules are easier to understand, reuse and change.

The degree of interaction between modules is coupling, the usual partner concept and the trap here. The number of classes and the depth of the inheritance hierarchy are size and structure metrics, not cohesion.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.