PrepAway - Latest Free Exam Questions & Answers

Which of the following is a favorable combination of cohesion and coupling?

In computer programming, cohesion and coupling are used to describe modules of code. Which of the following is a favorable combination of cohesion and coupling?

PrepAway - Latest Free Exam Questions & Answers

A.
Low cohesion, low coupling

B.
High cohesion, high coupling

C.
Low cohesion, high coupling

D.
High cohesion, low coupling

Explanation:
D: When a module is described as having high cohesion and low coupling, that is a good thing. Cohesion reflects how many different types of tasks a module can carry out. High
cohesion means that the module carries out one basic task (such as subtraction of values) or several tasks that are very similar (such as subtraction, addition, multiplication). The
higher the cohesion, the easier it is to update or modify and not affect the other modules that interact with it. This also means the module is easier to reuse and maintain because it is
more straightforward when compared to a module with low cohesion. Coupling is a measurement that indicates how much interaction one module requires to carry out its tasks. If a
module has low or loose coupling, this means the module does not need to communicate with many other modules to carry out its job. These modules are easier to understand and
easier to reuse than those that depend upon many other modules to carry out its tasks. It is also easier to make changes to these modules without affecting many modules around
them.
A is incorrect because a module with low cohesion is not desirable. A module with low cohesion carries out multiple different tasks and increases the complexity of the module,
which makes it harder to maintain and reuse. The higher a module’s cohesion, the fewer tasks it carries out and the easier it is to update or modify that module without affecting others
that interact with it.
B is incorrect because a module with high coupling is not desirable. High coupling means a module depends upon many other modules to carry out its tasks. This makes it difficult to
understand, reuse, and make changes because of the interdependencies with other modules. As an analogy, a company would want its employees to be able to carry out their
individual jobs with the least amount of dependencies on other workers. If Joe had to talk with five other people just to get one task done, too much complexity exists, it’s too timeconsuming,
and more places are created where errors can take place.
C is incorrect because it states the exact opposite of what is desirable. A module that has low cohesion and high coupling is complex in that it carries out multiple different types of
tasks and depends upon many other modules to carry them out. These characteristics make the module harder to maintain and reuse, largely because of the greater possibility of
affecting other modules that interact with it


Leave a Reply