• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Question from Mala gupta Programmer 2 - chapter 13. Full Mock exam. about coupling.

 
Ranch Hand
Posts: 472
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


ME-Q51. Which option defines loosely coupled classes? (Choose the best option.)
a
b
c
d

ME-A51. c
Explanation: Option (a) is incorrect because these classes aren’t related.
Option (b) is incorrect because class Pen directly accesses the instance variable
color of class Ink, making them tightly coupled classes. Tightly coupled classes are
difficult to change. Option (d) doesn’t compile.


my question about answer a, classes that aren`t related is not considered as loosely coupled? they not use api of each other. is relationship like usage of one class by other is mandatory in questions of coupling?
 
author & internet detective
Posts: 41405
854
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For choice A, the classes aren't coupled at all because they don't reference each other in either direction. It doesn't make sense to talk about loose vs tight coupling when there isn't any coupling at all. Hence no coupling.
 
We noticed he had no friends. So we gave him this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic