• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

coupling problem  RSS feed

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


sun preevaluation test




Which is true?
a. These classes are NOT coupled.
b. These classes are loosely coupled.
c. These classes are tightly coupled.
d. These classes are abstractly coupled.

my answer is c;is it correct
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah..c is the right answer
 
Sheriff
Posts: 9643
42
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but Class Two accesses field of One through accessor method. Is it because the method getX is package visible....
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please explain why it is tightly coupled and not loosely coupled? I'm not sure in questions about coupling and cohesion. I think loose coupling means that class Two doesn't know the implementation details about class One and uses it's API(interface), so I would say that b is correct - where am I wrong?

Thanks for answering
[ August 29, 2008: Message edited by: Rasto Slivensky ]
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, these classes are loosely coupled, because class Two is accessing the variable x using accessor method. and in both classes instance variables are private.

so option 'b' is true.

Can anyone tell what is this "abstractly coupled" and in which case two classes are NOT coupled
 
Ranch Hand
Posts: 811
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think these classes are loosely coupled which use methods to acces variable
[ August 30, 2008: Message edited by: Ninad Kulkarni ]
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If these two classes belongs to the same pprograme than it is loose coupling if difffrent than Class two can't see the implementation of Class one. so it is tight coupling.

note:
----------------------------------------------
please let me know whether am I right or not ?
----------------------------------------------
 
Bartender
Posts: 4089
54
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the two classes are tightly coupled,Because class Two's y depends on the implementation of getX() of class One.
 
Ankit Garg
Sheriff
Posts: 9643
42
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Classes are tightly coupled if they depend on the internal implementation of each other. But I don't think that acessor and mutator methods are considered internal implementations. My only concern is still that getX is not public....
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These two classes are loosly coupled and not tightly. So option B is correct. In tightly coupled methods if change code in class A then it do not affect class B so they not tighly coupled. Both implementation do not affect each other. and class B is using class A so there is loose coupling. I hope this thread is now clear.
 
Vijitha Kumara
Bartender
Posts: 4089
54
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right Narendra,I got it wrong first place. More explanation on this at sun
 
The harder you work, the luckier you get. This tiny ad brings luck - just not good luck or bad luck.
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!