Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Please ask technical questions in the appropriate category. Thank you!

Cohesion and coupling examples

User_19BPUMay 9 2012 — edited May 14 2012
Hi,


Increased cohesion and decreased coupling do lead to good software design.

Decoupling allows you to change the implementation without affecting other parts of your software.
Cohesion ensures that the implementation more specific to functionality and at the same time easier to maintain.
he most effective method of decreasing coupling and increasing cohesion is design by interface.

Example of Cohesion:-

Overloading a method of a class with more functionality will result in low cohesion. Hence to avoid that break the methods in to
small chunks (packets) and perform the operations which will result in better re usability and maintainability of the code.


Example of Coupling:-

Abstraction using a interface to invoke the respective methods in an action class without directly exposing the Implementation class by creating
an instance.

Please correct me if I have gone wrong. If so please do clarify.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 11 2012
Added on May 9 2012
5 comments
2,698 views