This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Confused about tight coupling Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Confused about tight coupling" Watch "Confused about tight coupling" New topic
Author

Confused about tight coupling

Sagar Shroff
Ranch Hand

Joined: Jun 07, 2011
Posts: 196

my question is if for eg there is a class A and class B then if class A uses public methods in class B then class A should be tightly coupled to class B......am i right please help???


OCJP-90%,OCPWCD-95%
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3065
    
    1

Yes, in this case classes will be tightly coupled. This is a bad thing.

[edit]

Wait sorry, I thought you said variables, not methods. When A calls methods of B, it will big coupled to B, but not nearly as tight as it would be if it accessed a public variable of B. The latter case is very very bad.
Sagar Shroff
Ranch Hand

Joined: Jun 07, 2011
Posts: 196

I am Sorry for using those short syntax......

So Stephan does that mean only if a class accesses variable of another class then it is tightly coupled to another class and it is also bad encapsulation. AM i right ??......

And in K.S book it had written that " Tight Coupling is the undesirable state of having classes that has many references to each other ,not well encapsulated..i understood this much but this last statement which says

and the breadth of API usage is more ....So what does this statement means ??
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Confused about tight coupling
 
Similar Threads
Doubt about diagram class (realization)
about arrays
regard on k&b book
Private Constructor
Doubt about diagram class