Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock question on package dependencies

 
David Follow
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Hi all,

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

D.
 
Geoffrey Chu
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic