Dependency visibility

Dependency analysis war story #3

After analysing the essential class-level dependencies we were puzzled: the dependencies seemed ok! What was wrong with our code if not dependencies?!

Further study revealed that the problems were caused by indirect dependencies, especially inheritance.

We had identified a new concept: dependency visibility. (At least I am not aware of any tool that analyzes this.) If class A publicly depends on class B by referring to it in its public signature (javap -public), then all users of A are forced to depend on B.

We upgraded our script to draw a bold arrow for public dependencies, and this immediately revealed the dependencies that caused our problems. An abstraction is useless (and just adds complexity) if it fails to hide its own dependencies.

Originally published on 2011-04-29 at under category Software Architecture