• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mock question on package dependencies

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

the question goes:
Since a dependency exists between two packages if a denpendency exists between any two classes in the packages, it can be deduced that all package dependencies are transitive in nature. True or False?

The answer is: False

However, I think if package A depends on package B and package B in turn depends on packge C then package A also depends (indirectly) on packge C, as in: A --> B --> C
Therefor I would say the answer to the above question should be "True". ....what am i missing?

D.
 
David Follow
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

come on people, please give me some ideas on this one!!!

D.
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A package contains multiple classes and therefore multiple interfaces (methods and arguments). So, if you add/extract a parameter in a function of Class X/Package C, you only have to change the classes that are calling this function, for example, Class Y/Package B.

Since NO Class from Package A is calling Class X/Package C, then you do not need to change anything in A because of the change in C. Then, the dependency is only between B and C. Changing the call doesn't mean that you are changing the inteface definition in Package B.

Answer: Dependencies are not transitive.

ONLY if you change interface signatures in Package B will affect Package A. Same logic with Package C and Package B.

I hope it helps,

Geoffrey




Originally posted by David Follow:
Hi all,

come on people, please give me some ideas on this one!!!

D.



[ April 18, 2005: Message edited by: Geoffrey Chu ]
[ April 18, 2005: Message edited by: Geoffrey Chu ]
 
Geoffrey Chu
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Geoffrey Chu:
A package contains multiple classes and therefore multiple interfaces (methods and arguments). So, if you add/extract a parameter in a function of Class X/Package C, you only have to change the classes that are calling this function, for example, Class Y/Package B.

Since NO Class from Package A is calling Class X/Package C, then you do not need to change anything in A because of the change in C. Then, the dependency is only between B and C. Changing the interface signature in C doesn't mean that you have to change the inteface definition in Package B.

Answer: Dependencies are not transitive.

ONLY if you change interface signatures in Package B will affect Package A. Same logic with Package C and Package B.

{Indirect dependencies}, {might or might not change} do not count. The point is that dependencies are not transitive.

I hope it helps David, good luck

Geoffrey






[ April 18, 2005: Message edited by: Geoffrey Chu ]

[ April 18, 2005: Message edited by: Geoffrey Chu ]

 
reply
    Bookmark Topic Watch Topic
  • New Topic