Network Motifs in Object-Oriented Software Systems

Yutao Ma, Keqing He, Jing Liu

Abstract

Nowadays, software has become a complex piece of work that may be beyond our control. Understanding how software evolves over time plays an important role in controlling software development processes. This study investigates the principles of software evolution by applying complex network theories to the structural changes in object-oriented software systems. By analyzing network motifs—small, recurring structural patterns—we find that a motif's stability positively correlates with its abundance. Furthermore, motifs with high Z-scores tend to exhibit stable structures. These findings suggest that software evolution is driven by functional cloning and structural duplication, favoring structural stability. This work provides valuable insights for reverse engineering and the analysis of structural changes in software systems.

Introduction: The "DNA" of Code

As software systems grow in scale and complexity, they often reach a point where traditional metrics like lines of code (LOC) or simple class counts fail to capture the underlying architecture. This research addresses a fundamental question: Are there universal rules governing how software structure evolves? By treating object-oriented (OO) software as a complex network, we can identify recurring subgraphs, or "network motifs," that serve as the building blocks of the system. Much like biological systems, software evolution appears to favor patterns that provide structural stability and facilitate functional "cloning."

Methods and Datasets

The study modeled six diverse OO software systems—ranging from the Visualization Toolkit (VTK) and Tomcat to specialized frameworks like Digital Material (DM) and commercial systems like SCRR—as directed graphs. In these graphs, nodes represent classes or modules, while edges represent relationships such as inheritance or method calls.

To analyze these networks, the researchers employed:

  • Motif Detection: Identifying 3-node and 4-node subgraphs that appear significantly more often in real software than in randomized networks.
  • Z-Scores: A statistical measure of a motif's significance; high Z-scores indicate non-random, essential building blocks.
  • Structural Stability Score (SSS): Motifs were categorized into three classes based on their response to perturbations: Class I (highly stable, e.g., acyclic), Class II (moderately stable, e.g., single feedback loop), and Class III (unstable, e.g., complex multi-loop circuits).
Motif occurrence for three-node and four-node subgraphs across the studied software systems.

Key Insights: Stability and Simplicity

The analysis revealed several critical principles driving software architecture:

  • Stability-Driven Selection: Structural stability is a primary evolutionary driver. Motifs resistant to failures (Class I) are significantly more abundant than unstable ones.
  • Simplicity and Reusability: Simpler motifs with fewer edges are encountered more frequently. Fewer constraints on interactions make these micro-structures easier to reproduce or "clone" across a system.
  • The Feedback Loop Penalty: Similar to McCabe’s cyclomatic complexity, the presence of feedback loops decreases a motif's stability, explaining the common engineering practice of avoiding circular dependencies.

Results: Significance and Stability

The experimental results consistently showed a positive correlation between a motif's abundance and its structural stability across all six datasets, regardless of the programming language (C++ vs. Java) or application domain.

Normalized Z-scores and their distribution across stability classes (I, II, III) for 3-edge and 4-edge motifs.

Motifs with the highest Z-scores—those most statistically significant to the system's structure—almost exclusively belong to the most stable classes (Class I or II). Statistical validation using the Kruskal-Wallis test confirmed that the differences in Z-scores between stability classes were significant, often with greater than 95% confidence.

Conclusion

This research reinforces the view of software systems as artificial complex networks that share properties like "Small World" and "Scale-Free" characteristics with biological networks. The preference for stable, simple motifs suggests that software evolution is a non-random process aimed at maintaining structural integrity. Future work will focus on "evolution complexity," quantifying the cost of changing these micro-structures and how such changes propagate through a system's architecture.

Summary updated

Abstract

Nowadays, software has become a complex piece of work that may be beyond our control. Understanding how software evolves over time plays an important role in controlling software development processes. Recently, a few researchers found the quantitative evidence of structural duplication in software systems or web applications, which is similar to the evolutionary trend found in biological systems. To investigate the principles or rules of software evolution, we introduce the relevant theories and methods of complex networks into structural evolution and change of software systems. According to the results of our experiment on network motifs, we find that the stability of a motif shows positive correlation with its abundance and a motif with high Z score tends to have stable structure. These findings imply that the evolution of software systems is based on functional cloning as well as structural duplication and tends to be structurally stable. So, the work presented in this paper will be useful for the analysis of structural changes of software systems in reverse engineering.
BibTeX
@misc{ma2008network,
  author = {Yutao Ma and Keqing He and Jing Liu},
  title = {{Network Motifs in Object-Oriented Software Systems}},
  year = {2008},
  eprint = {0808.3292},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/0808.3292},
}
Figure