jump to navigation

Just What is Dependency Analysis? January 31, 2010

Posted by Peter Varhol in Architectures, Software development.

A couple of weeks ago I wrote a post on using dependency analysis at application design time.  That generated a good bit of interest, including several emails asking for further information about dependency analysis and why it was important.  I’m going to try to answer some of those questions here.

Dependency analysis is a fundamental look at the structure of an application or design.  There are certain sets of good practices that permeate various aspects of software development.  Some of them are both readily understandable and easy to implement – use a naming convention for variables, and keep methods to a certain number of lines.

Dependency analysis is more complex, in part because it looks at the entire application rather than just individual pieces.  In terms of information it provides about an application, it is similar to McCabe cyclomatic complexity analysis, or cohesion and coupling, although the information itself is different.  Dependency analysis adds another dimension to the concept that code structure and organization is important throughout the application lifecycle.

Dependencies between code modules (assemblies, jars, even individual methods) are a fact of programming life.  A calls B, and B calls C.  Without reverting to a “flat” language such as Fortran, we want this type of hierarchical structure so that the application is organized, easy to code and to follow, and segregates functions so that both bugs and places for enhancement can be readily located.  It makes writing large applications easier and with fewer bugs, because the application structure is logical and understood by the team.

Why should you look at the dependencies in an application, from design through maintenance?  “Bad” dependencies, such as cyclic dependencies, or unstable dependencies, can result in more bugs as developers lose track of how the application is put together.  It’s similar to the concept of regression in QA – when you fix one bug, poor structure and understanding of interrelationships makes it more likely that you introduce other, related bugs.

Does this mean that dependency analysis should be limited to large and complex applications where the risk of a bug had significant consequences?  No, not at all.  It will improve the quality of any application, without a significant effort in time or effort on the part of the development team.

It’s difficult to fully appreciate dependency analysis because it you can’t see an immediate fix or benefit or improvement.  Over time, you may notice that the code is easier to write, that there are fewer bugs, and those that exist are easier to fix, and that it will be easily for new team members to understand the code and contribute more quickly.

While such benefits are difficult to see and measure, they are real.  And by introducing dependency analysis into the design process, development teams can start off with a better and more understandable application structure.



No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: