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.
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 ]
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
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 ? ----------------------------------------------
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....
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.