Method Design Issues: Implementation Hiding, Cohesion, and Coupling
4 posters
Advanced Modularization Techniques :: Advanced Modularization Techniques :: Advanced Modularization Techniques
Page 1 of 1
Method Design Issues: Implementation Hiding, Cohesion, and Coupling
To design effective methods, you should consider several program qualities:
Understanding Implementation Hiding
An important principle of modularization is the notion of implementation hiding , the
encapsulation of method details. That is, when a program makes a request to a method, it
doesn’t know the details of how the method is executed.
Increasing Cohesion
To help determine the appropriate division of tasks among methods, you want to analyze
each method’s cohesion , which refers to how the internal statements of a method serve to
accomplish the method’s purpose. In highly cohesive methods, all the operations are related,
or “go together.” Such methods are functionally cohesive —all their operations contribute to
the performance of a single task. Functionally cohesive methods usually are more reliable
than those that have low cohesion; they are considered stronger, and they make programs
easier to write, read, and maintain.
Reducing Coupling
Coupling is a measure of the strength of the connection between two program methods; it
expresses the extent to which information is exchanged by methods. Coupling is either tight
or loose, depending on how much one method relies on information from another. Tight
coupling , which occurs when methods depend on each other excessively, makes programs
more prone to errors. With tight coupling, you have many data paths to keep track of, many
chances for bad data to pass from one method to another, and many chances for one method
to alter information needed by another method. Loose coupling occurs when methods do
not depend on others. In general, you want to reduce coupling as much as possible
because connections between methods make them more difficult to write, maintain,
and reuse.
- You should employ implementation hiding; that is, a method’s client should not need to
understand a method’s internal mechanisms.
- You should strive to increase cohesion.
- You should strive to reduce coupling.
Understanding Implementation Hiding
An important principle of modularization is the notion of implementation hiding , the
encapsulation of method details. That is, when a program makes a request to a method, it
doesn’t know the details of how the method is executed.
Increasing Cohesion
To help determine the appropriate division of tasks among methods, you want to analyze
each method’s cohesion , which refers to how the internal statements of a method serve to
accomplish the method’s purpose. In highly cohesive methods, all the operations are related,
or “go together.” Such methods are functionally cohesive —all their operations contribute to
the performance of a single task. Functionally cohesive methods usually are more reliable
than those that have low cohesion; they are considered stronger, and they make programs
easier to write, read, and maintain.
Reducing Coupling
Coupling is a measure of the strength of the connection between two program methods; it
expresses the extent to which information is exchanged by methods. Coupling is either tight
or loose, depending on how much one method relies on information from another. Tight
coupling , which occurs when methods depend on each other excessively, makes programs
more prone to errors. With tight coupling, you have many data paths to keep track of, many
chances for bad data to pass from one method to another, and many chances for one method
to alter information needed by another method. Loose coupling occurs when methods do
not depend on others. In general, you want to reduce coupling as much as possible
because connections between methods make them more difficult to write, maintain,
and reuse.
Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling
High-cohesion means well-structured classes and loose coupling means more flexible, extensible software.
skl
skl
johnarnold- GURU
- Posts : 10
Join date : 2018-08-23
Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling
Disadvantages of Coupling
Tightly coupled systems tend to exhibit the following developmental characteristics, which are often seen as disadvantages:
1.A change in one module usually forces a ripple effect of changes in other modules.
2.Assembly of modules might require more effort and/or time due to the increased inter-module dependency.
3.A particular module might be harder to reuse and/or test because dependent modules must be included.
Tightly coupled systems tend to exhibit the following developmental characteristics, which are often seen as disadvantages:
1.A change in one module usually forces a ripple effect of changes in other modules.
2.Assembly of modules might require more effort and/or time due to the increased inter-module dependency.
3.A particular module might be harder to reuse and/or test because dependent modules must be included.
johnarnold- GURU
- Posts : 10
Join date : 2018-08-23
Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling
Advantages of Cohesion
1.Reduced module complexity (they are simpler, having fewer operations).
2.Increased system maintainability, because logical changes in the domain affect fewer modules, and because changes in one module require fewer changes in other modules.
3.Increased module reusability, because application developers will find the component they need more easily among the cohesive set of operations provided by the module.
skl po
1.Reduced module complexity (they are simpler, having fewer operations).
2.Increased system maintainability, because logical changes in the domain affect fewer modules, and because changes in one module require fewer changes in other modules.
3.Increased module reusability, because application developers will find the component they need more easily among the cohesive set of operations provided by the module.
skl po
johnarnold- GURU
- Posts : 10
Join date : 2018-08-23
Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling
What is coupling and cohesion in Java?
johnarnold- GURU
- Posts : 10
Join date : 2018-08-23
Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling
What is Hiding, Coupling and Cohesion in Python?
thegreatunknown- GURU
- Posts : 10
Join date : 2018-09-03
Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling
Woah Nicejohnarnold wrote:High-cohesion means well-structured classes and loose coupling means more flexible, extensible software.
skl
thegreatunknown- GURU
- Posts : 10
Join date : 2018-09-03
Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling
Implementation Hiding is a very good quality in designs because it gives you an effective and intelligent program. Of course, the others mentioned as well.
thegreatunknown- GURU
- Posts : 10
Join date : 2018-09-03
Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling
Why do we need to reduce the connection of the 2 program methods ?
DespicableMe- GURU
- Posts : 10
Join date : 2018-10-01
Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling
We need to hide the methods of our program so the user cannot change what insidebof the method. Am I right admin?
DespicableMe- GURU
- Posts : 10
Join date : 2018-10-01
Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling
what is the disadvantage and advantage of Tight coupling?
DespicableMe- GURU
- Posts : 10
Join date : 2018-10-01
Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling
and also in Loose coupling, what are the disadvantages and advantages ?
DespicableMe- GURU
- Posts : 10
Join date : 2018-10-01
Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling
what will happen if we did not increase the cohesion of a program?
DespicableMe- GURU
- Posts : 10
Join date : 2018-10-01
Advanced Modularization Techniques :: Advanced Modularization Techniques :: Advanced Modularization Techniques
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|