Computer Science, asked by abralincoln, 1 year ago

explain why a design with low coupling helps maintainability

Answers

Answered by bishal2744
0
500 Internal Server Error

What do low coupling and high cohesion mean? What does the principle of encapsulation mean?

 500internalservererror

10 years ago

Advertisements

Low Coupling

Coupling refers to the relationship of a module with another module. A module is said to be highly coupled with another module if changes to it will result to changes to the other module. And a module is said to be loosely coupled if a module is independent of any other modules. This can be achieved by having a stable interface that effectively hides the implementation of another module. 

Benefits of low coupling are

maintainability – changes are confined in a single module

testability – modules involved in unit testing can be limited to a minimum

readability – classes that need to be analyzed are kept at a minimum

 

High Cohesion

Cohesion refers to the measure of how strongly-related the functions of a module are. Low cohesion refers to modules that have different unrelated responsibilities. High cohesion refers to modules that have functions that are similar in many aspects.

The benefits of high cohesion are

Readability – (closely) related functions are contained in a single module

Maintainability – debugging tends to be contained in a single module

Reusability – classes that have concentrated functionalities are not polluted with useless functions

 

Principle of Encapsulation

Encapsulation is synonymous to information hiding. It is the process of concealing the internal representation and implementation of a class. Encapsulation shields the class from misuse and thus increases the resuability of the class. That is, it hides the implementation such that the internal structure of a class is free to change without affecting the implementation of the classes that use this particular class. 

Advertisements

Categories: CS

Tags: 100 questions

Leave a Comment

500 Internal Server Error

Blog at WordPress.com.

Back to top

Advertisements


Similar questions