Aspects of good software design

The following are some aspects which are important for good software design:

Aspect Guideline Metric Visibility  
Naming Names should reflect problem domain. None High  
Complexity Methods should have a low cyclomatic complexity. <10 High  
Cohesion Modules should be small and follow the single responsibility principle. <1KLOC High  
Coupling Low coupling and dependencies towards abstractions and interfaces. No cycles. None Low  

All these aspects except coupling can be easily observed from the source code using an IDE or editor. The impact of the lack of visibility for coupling is that problems with software dependencies often go undetected.

Why software dependencies matter

Ideally, software can be easily modified, is understandable, reliable and reusable. In practice, this often remains an ideal and over the course of time the software becomes increasingly rigid, opaque and fragile. In many cases the underlying cause is that the dependency structure of the software degrades over time.

evolution of junit dependencies across releases

Figure 1: The evolution of the dependency structure of JUnit

A study by Dan Sturtevant investigated the impact of software dependencies on defect rate, productivity and staff turnover. It classified modules into the following types:

The outcome of the study was that software dependencies have the following impact:

Defect rate

cost of complexity

Figure 2: Complexity versus defect rate

Lower productivity

Higher staff turnover

For detailed information about this study see this presentation or this video.

This study confirms the results from an earlier US Air Force study, which showed that well-structured software is delivered in half the time, at half the cost, with 8x less bugs.

For detailed information about this study see this document

Why software dependency management is hard

Although the impact of poor dependencies is well known, many software projects are struggling with it. This can have one of the following reasons:

Human

Architecture Control

Architecture Visualization

Design structure matrix

A design structure matrix consists of a matrix to visualize dependencies of hierarchically organized elements and a set of algorithms which can be applied on the matrix to sort the elements in order to discover layering.

An example of a design structure matrix is shown below:

example dsm Figure 3: Design structure matrix

Application Area

Some common usage scenarios for DSM visualization of the code architecture are:

Advantages

DSM visualization is a technique for analysing, improving, and managing complex system architectures.

For more information on design structure matrix see the DSM Overview.