File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Understanding Coupling versus Cohesion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Understanding Coupling versus Cohesion" Watch "Understanding Coupling versus Cohesion" New topic

Understanding Coupling versus Cohesion

Richard Broersma
Ranch Hand

Joined: Apr 28, 2009
Posts: 63

I purchased a SCJP test question practice tool.

One question is:

"Which of the following concepts is a measure of inter-class dependencies? "

My intuition is that coupling is related the concept of inter-class dependencies. However, according to the testing tool, Cohesion is a measure of inter-class dependencies.

I figure that my understand of cohesion must be incomplete because I can't seem to accept this as the correct answer.

Can anyone explain why inter-class dependencies are associated with cohesion and not coupling?
Ruben Soto
Ranch Hand

Joined: Dec 16, 2008
Posts: 1032

You are correct. Coupling measures inter-class dependency. Cohesion measures how focused a class is. In other words, a class should do only a few very related things, as opposed to combining functionality that should be split in different classes to promote modularity and code reuse.

All code in my posts, unless a source is explicitly mentioned, is my own.
Richard Broersma
Ranch Hand

Joined: Apr 28, 2009
Posts: 63

Thanks for the clarification. I'll submit a bug report to the testing software.
W. Joe Smith
Ranch Hand

Joined: Feb 10, 2009
Posts: 710
Richard Broersma wrote:I purchased a SCJP test question practice tool.

Which one? I ask because you may be able to search this forum (or others, the internet is huge...) to find a list of exam errata.

When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
Richard Broersma
Ranch Hand

Joined: Apr 28, 2009
Posts: 63

This is the certification test tool that I am using. I would love to find errata for this tool.
I agree. Here's the link:
subject: Understanding Coupling versus Cohesion
It's not a secret anymore!