The following figure represents access graphs of two modules M1 and M2. The filled circles represent methods and the unfilled circles represent attributes. If method m is moved to module M2 keeping the attributes where they are, what can we say about the average cohesion and coupling between modules in the system of two modules?
(A) There is no change.
(B) Average cohesion goes up but coupling is reduced.
(C) Average cohesion goes down and coupling also reduces.
(D) Average cohesion and coupling increase.
Explanation: Answer is “No Change”
Cohesion refers to the degree to which the elements of a module belong together.
Coupling is the manner and degree of interdependence between software modules
Coupling between M1 and M2 = (Number of external links) / (Number of modules) = 2/2 = 1 Cohesion of a module = (Number of internal links) / (Number of methods) Cohesion of M1 = 8/4 = 2 Cohesion of M2 = 6/3 = 2 After moving method m to M2, we get following Coupling = 2/2 = 1 Cohesion of M1 = 6/3 = 2 Cohesion of M2 = 8/4 = 2