Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Each of the following heuristics helps make a good module according to some modu

ID: 3690312 • Letter: E

Question

Each of the following heuristics helps make a good module according to some modularity principle. Identify the principle.

(a) Make all attributes of a class protected or private.

(b) A class should capture exactly one key abstraction.

(c) Make sure an operation needs all its parameters.

(d) Spin off unrelated data into another class.

(e) Minimize the number of classes with which a class collaborates.

(f) Most of the operations in a class should use most of the attributes most of the time.

(g) Model the real world whenever possible.

(h) Do not change the state of an object without going through its public interface.

Explanation / Answer

a) Make all attributes of a class protected or private. - Principle of Information Hiding

Explanation: Using the Principle of information hiding. As private and protected members of a class cannot be used outside. Thus, the Principle of information hiding can be used here.

b) A class should capture exactly one key abstraction. - Principle of Least Privilege

Explanation: Use least Privilege principle, to avoid or use very less. If a class captures exactly one key abstraction then least Privilege principle is used.

c) Make sure an operation needs all its parameters. - Principle of Cohesion

Explanation: Using the Principle of Cohesion, as, use all the parameters of the function to complete an operation.

d) Spin off unrelated data into another class. - Principle of Least Privilege

Explanation: Use least Privilege principle, to create an important class by using the unrelated data or different methods.

e) Minimize the number of classes with which a class collaborates. - Principle of Coupling

Explanation: Using the Principle of Coupling, to the interdependence of each class. If the coupling is low, then the structure of the program will be better.

f) Most of the operations in a class should use most of the attributes most of the time. - Principle of Cohesion

Explanation: Using the Principle of Cohesion, as, a single module or class taking the responsibility of all or most of its operations.

g) Model the real world whenever possible. -Principle of Small Modules

Explanation: Use principle of small modules, as model is complex and need to divide in small modules to make it easily designed and to develop.

h) Do not change the state of an object without going through its public interface. -Principle of Information Hiding

Explanation: Using the Principle of information hiding. As, to avoid the state change of an object, make it private and cannot be used in public interface. Thus, information hiding concept is used.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote