TL;DR
This paper introduces the Dependency Structure Matrix (DSM) as a powerful tool for managing complex software architectures. By visualizing inter-module dependencies, DSMs help identify architectural violations, guide refactoring efforts, and ensure code conformance to design intent, ultimately leading to more maintainable and robust software systems.
What Problem Does This Paper Address?
Managing the architecture of large software systems is a significant challenge. As systems grow, inter-module dependencies can become excessively complex, leading to tightly coupled modules that are difficult to understand, modify, and extend. This "architectural creep" makes systems brittle and prone to errors, especially when documentation lags behind code evolution or when original architects leave. The paper aims to provide a systematic approach to understanding, visualizing, and enforcing software architecture by leveraging dependency analysis.
Methods
The core of the paper is the application of the Dependency Structure Matrix (DSM) to software architecture.
- Dependency Extraction: Dependencies between software modules (initially Java classes, but extensible) are extracted using conventional static analysis. A module A depends on module B if there are explicit references in A to syntactic elements of B.
- Dependency Structure Matrix (DSM): Dependencies are visualized in a tabular form, similar to an adjacency matrix. Modules are listed on both axes, and an 'X' indicates a dependency.
- Partitioning and Clustering: Algorithms are used to reorder and group modules within the DSM. This process aims to create a "block triangular" form, where dependencies are primarily below the diagonal, revealing a layered or hierarchical structure. This is analogous to how DSMs are used in manufacturing for process optimization.
- Hierarchical Structure: The DSM can represent a hierarchical decomposition of the system, allowing analysis at different levels (e.g., packages, subsystems). This hierarchy can be derived automatically from code organization or refined through user input.
- Design Rules: Users define "design rules" that specify acceptable and unacceptable dependencies. These rules capture the architect's intent and can be applied to the DSM to highlight violations. Rules can be specified using "can-use" and "cannot-use" directives, with support for wildcards and hierarchical inheritance.
- LDM Tool: The paper describes LDM (Lattix Inc.'s dependency manager), a tool that implements these techniques, allowing for automatic dependency extraction, DSM visualization, partitioning, and design rule checking.
Datasets
The paper uses two primary examples for evaluation:
- JUnit version 3.8.1: An open-source regression testing framework.
- jEdit version 4.2: An open-source text editor with approximately 800 classes.
- Haystack: A research prototype tool for managing personal information, consisting of approximately 196,707 lines of Java code. This served as the main case study for demonstrating the approach's effectiveness in reengineering and managing a complex, evolving system with limited documentation.
Key Insights and Ideas
- DSM Scales Better Than Graphs: The matrix representation of dependencies scales more effectively than traditional box-and-line diagrams for complex systems, especially when combined with hierarchical views.
- Architectural Patterns Emerge Naturally: The partitioning algorithms applied to the DSM can automatically reveal underlying architectural patterns like layering, even in imperfectly implemented systems.
- Design Rules Formalize Intent: Explicitly defining design rules allows for a clear articulation of architectural intent and provides a mechanism for continuous checking against that intent, preventing architectural drift.
- Hidden Subsystems are Key: The DSM approach can help identify "hidden subsystems" – modules with limited external dependencies – which are crucial for modularity and maintainability.
- Refactoring Guidance: By highlighting violations and unexpected dependencies, DSMs provide concrete guidance for refactoring efforts, making the process more targeted and effective.
- Bridging Design and Implementation Gaps: The tool is particularly valuable in situations where documentation is scarce or outdated, allowing architects to reconstruct and enforce the intended architecture from the code itself.
Key Results
The paper demonstrates the utility of the DSM approach through case studies:
- JUnit: The DSM revealed a layered system with clean separation between UI and core logic.
- jEdit: The DSM highlighted a large number of dependencies in the top-level package, suggesting potential areas for refactoring.
- Haystack: The case study showed that the DSM approach was effective in:
- Extracting the architecture of a complex system with limited documentation.
- Identifying architectural violations and inconsistencies (e.g., dependencies in supposedly independent regions).
- Guiding refactoring efforts, leading to a cleaner conceptual architecture.
- Defining design rules that captured architectural decisions and allowed for automated checking.
- The rearchitected DSM for Haystack showed a significant reduction in dependencies in problematic areas compared to the initial DSM.
Limitations and Future Work
- Readability of Matrices: While scalable, DSMs can still be challenging to read, especially for finding specific cells or tracing transitive dependencies. The authors note that proficiency increases with practice.
- Dependency Model Granularity: The current dependency model is based on explicit references. The authors suggest that a richer model, potentially incorporating runtime behavior or interface-mediated dependencies, could be beneficial.
- Orthogonal Views: For systems with multiple, orthogonal architectural views, representing and managing dependencies across these views within a single DSM can be complex.
- Future Work: The authors plan to explore more refined notions of dependency, investigate the impact of design rules on architectural evolution, and potentially incorporate richer dependency models into the tool. They also suggest exploring the effectiveness of their approach in distributed organizations.
Summary updated