Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Go down

Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by Admin on Fri Aug 17, 2018 8:40 am

To design effective methods, you should consider several program qualities:

  • 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.
avatar
Admin
Admin

Posts : 3
Join date : 2018-08-13
Age : 20

View user profile http://odessaeiman.forumotion.com

Back to top Go down

Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by johnarnold on Thu Aug 23, 2018 12:38 pm

High-cohesion means well-structured classes and loose coupling means more flexible, extensible software.
skl

johnarnold
GURU

Posts : 10
Join date : 2018-08-23

View user profile

Back to top Go down

Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by johnarnold on Thu Aug 23, 2018 12:45 pm

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.

johnarnold
GURU

Posts : 10
Join date : 2018-08-23

View user profile

Back to top Go down

Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by johnarnold on Thu Aug 23, 2018 12:48 pm

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

johnarnold
GURU

Posts : 10
Join date : 2018-08-23

View user profile

Back to top Go down

Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by johnarnold on Thu Aug 23, 2018 12:56 pm

What is coupling and cohesion in Java?

johnarnold
GURU

Posts : 10
Join date : 2018-08-23

View user profile

Back to top Go down

Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by thegreatunknown on Mon Sep 03, 2018 1:34 pm

What is Hiding, Coupling and Cohesion in Python?

thegreatunknown
GURU

Posts : 10
Join date : 2018-09-03

View user profile

Back to top Go down

Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by thegreatunknown on Mon Sep 03, 2018 1:50 pm

johnarnold wrote:High-cohesion means well-structured classes and loose coupling means more flexible, extensible software.
skl
Woah Nice

thegreatunknown
GURU

Posts : 10
Join date : 2018-09-03

View user profile

Back to top Go down

Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by thegreatunknown on Mon Sep 03, 2018 1:54 pm

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

View user profile

Back to top Go down

Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by DespicableMe on Mon Oct 01, 2018 10:23 pm

Why do we need to reduce the connection of the 2 program methods ?

DespicableMe
GURU

Posts : 10
Join date : 2018-10-01

View user profile

Back to top Go down

Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by DespicableMe on Mon Oct 01, 2018 10:27 pm

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

View user profile

Back to top Go down

Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by DespicableMe on Wed Oct 03, 2018 9:28 am

what is the disadvantage and advantage of Tight coupling?

DespicableMe
GURU

Posts : 10
Join date : 2018-10-01

View user profile

Back to top Go down

Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by DespicableMe on Wed Oct 03, 2018 9:29 am

and also in Loose coupling, what are the disadvantages and advantages ?

DespicableMe
GURU

Posts : 10
Join date : 2018-10-01

View user profile

Back to top Go down

Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by DespicableMe on Wed Oct 03, 2018 10:16 am

what will happen if we did not increase the cohesion of a program?

DespicableMe
GURU

Posts : 10
Join date : 2018-10-01

View user profile

Back to top Go down

Re: Method Design Issues: Implementation Hiding, Cohesion, and Coupling

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum