Skip to main content
Log in

An empirical study of untangling patterns of two-class dependency cycles

  • Published:
Empirical Software Engineering Aims and scope Submit manuscript

Abstract

Dependency cycles pose a significant challenge to software quality and maintainability. However, there is limited understanding of how practitioners resolve dependency cycles in real-world scenarios. This paper presents an empirical study investigating the recurring patterns employed by software developers to resolve dependency cycles between two classes in practice. We analyzed the data from 38 open-source projects across different domains and manually inspected hundreds of cycle untangling cases. Our findings reveal that developers tend to employ five recurring patterns to address dependency cycles. The chosen patterns are not only determined by dependency relations between cyclic classes, but also highly related to their design context, i.e., how cyclic classes depend on or are depended by their neighbor classes. Through this empirical study, we also discovered three common counterintuitive solutions developers usually adopted during cycles’ handling. These recurring patterns and common counterintuitive solutions observed in dependency cycles’ practice can serve as a taxonomy to improve developers’ awareness and also be used as learning materials for students in software engineering and inexperienced developers. Our results also suggest that, in addition to considering the internal structure of dependency cycles, automatic tools need to consider the design context of cycles to provide better support for refactoring dependency cycles.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10

Similar content being viewed by others

Data Availibility Statement

The data generated and analyzed during the current study is available in the Zenodo repository at Feng et al. (2023).

Notes

  1. https://www.designite-tools.com

  2. https://structure101.org

  3. https://www.sonarqube.org

  4. https://github.com/multilang-depends/depends

  5. https://github.com/apache/wicket/commit/dec227e

  6. https://github.com/apache/ant/commit/ca5799f

  7. https://github.com/apache/hbase/commit/dd70cc3

  8. https://github.com/apache/ant/commit/284e790

  9. https://github.com/apache/wicket/commit/829caa5

  10. https://github.com/apache/ambari/commit/73819ca

  11. https://github.com/apache/wicket/commit/f96f99e

  12. https://github.com/apache/wicket/commit/763dcc3

  13. https://github.com/apache/commons-math/commit/3a7d733

  14. https://issues.apache.org/jira/browse/MATH-689

  15. https://archdia.com

References

  • Bavota G, Dit B, Oliveto R, Di Penta M, Poshyvanyk D, De Lucia A (2013) An empirical study on the developers’ perception of software coupling. In: Proceedings of the 35th international conference on software engineering (ICSE), IEEE, pp 692–701

  • Cai H, Zheng VW, Chang KCC (2018) A comprehensive survey of graph embedding: problems, techniques, and applications. IEEE Trans Knowl Data Eng 30(9):1616–1637

    Article  Google Scholar 

  • Campbell JL, Quincy C, Osserman J, Pedersen OK (2013) Coding in-depth semistructured interviews: problems of unitization and intercoder reliability and agreement. Sociol Methods Res 42(3):294–320

    Article  MathSciNet  Google Scholar 

  • Caracciolo A, Aga B, Lungu M, Nierstrasz O (2016) Marea: a semi-automatic decision support system for breaking dependency cycles. In: Proceedings of the 23rd IEEE international conference on software analysis, evolution, and reengineering (SANER), IEEE, pp 482–492

  • Chawla NV, Bowyer KW, Hall LO, Kegelmeyer WP (2002) Smote: synthetic minority over-sampling technique. J Artif Intell Res 16:321–357

    Article  Google Scholar 

  • Cui D, Wang S, Luo Y, Li X, Dai J, Wang L, Li Q (2022) Rmove: recommending move method refactoring opportunities using structural and semantic representations of code. In: Proceedings of the 38th IEEE international conference on software maintenance and evolution (ICSME), IEEE, pp 281–292

  • Dietrich J, McCartin C, Tempero E, Shah SMA (2010) Barriers to modularity-an empirical study to assess the potential for modularisation of java programs. In: Proceedings of the 6th international conference on the quality of software architectures (QoSA), Springer, pp 135–150

  • Feng Q, Mo R (2023) Fine-grained analysis of dependency cycles among classes. J Softw: Evol Proc 35(1):e2496

    Google Scholar 

  • Feng Q, Cai Y, Kazman R, Cui D, Liu T, Fang H (2019) Active hotspot: an issue-oriented model to monitor software evolution and degradation. In: Proceedings of the 34th IEEE/ACM international conference on automated software engineering (ASE), IEEE, pp 986–997

  • Feng Q, Liu S, Ji H, Ma X, Liang P (2023) Replication package of the paper: an Empirical study of untangling patterns of two-class dependency cycles. https://doi.org/10.5281/zenodo.8048164

  • Ferreira T, Ivers J, Yackley JJ, Kessentini M, Ozkaya I, Gaaloul K (2023) Dependent or not: detecting and understanding collections of refactorings. IEEE Trans Softw Eng 49(6):3344–3358

    Google Scholar 

  • Fowler M, Beck K (1999) Refactoring: Improving the Design of Existing Code. Addison-Wesley Professional, Boston, Massachusetts

    Google Scholar 

  • Goldstein M, Moshkovich D (2014) Improving software through automatic untangling of cyclic dependencies. In: Proceedings of the 36th international conference on software engineering (ICSE) companion, ACM, pp 155–164

  • Grover A, Leskovec J (2016) node2vec: scalable feature learning for networks. In: Proceedings of the 22nd ACM SIGKDD international conference on knowledge discovery and data mining (KDD), ACM, pp 855–864

  • Jiang N, Lutellier T, Tan L (2021) Cure: code-aware neural machine translation for automatic program repair. In: Proceedings of the 43rd IEEE/ACM international conference on software engineering (ICSE), IEEE, pp 1161–1173

  • Kim D, Nam J, Song J, Kim S (2013) Automatic patch generation learned from human-written patches. In: 2013 35th International conference on software engineering (ICSE), IEEE, pp 802–811

  • Kim M, Zimmermann T, Nagappan N (2014) An empirical study of refactoring challenges and benefits at microsoft. IEEE Trans Softw Eng 40(7):633–649

    Article  Google Scholar 

  • Koyuncu A, Liu K, Bissyandé TF, Kim D, Klein J, Monperrus M, Le Traon Y (2020) Fixminer: mining relevant fix patterns for automated program repair. Empir Softw Eng 25:1980–2024

    Article  Google Scholar 

  • Lacerda G, Petrillo F, Pimenta M, Guéhéneuc YG (2020) Code smells and refactoring: a tertiary systematic review of challenges and observations. J Syst Softw 167:110610

    Article  Google Scholar 

  • Lakos J (1996) Large-Scale C++ Software Design. Addison-Wesley, Reading, MA

    Google Scholar 

  • Li R, Liang P, Soliman M, Avgeriou P (2022) Understanding software architecture erosion: a systematic mapping study. J Softw: Evol Proc 34(3):e2423

    Google Scholar 

  • Li Y, Wang S, Nguyen TN (2020) Dlfix: context-based code transformation learning for automated program repair. In: Proceedings of the 42nd ACM/IEEE international conference on software engineering (ICSE), ACM, pp 602–614

  • Lin Y, Peng X, Cai Y, Dig D, Zheng D, Zhao W (2016) Interactive and guided architectural refactoring with search-based recommendation. In: Proceedings of the 24th ACM SIGSOFT international symposium on foundations of software engineering (FSE), ACM, pp 535–546

  • Liu H, Liu Q, Liu Y, Wang Z (2015) Identifying renaming opportunities by expanding conducted rename refactorings. IEEE Trans Softw Eng 41(9):887–900

    Article  Google Scholar 

  • Liu W, Chen B, Peng X, Sun Q, Zhao W (2021) Identifying change patterns of api misuses from code changes. Science China Information Sciences 64:1–19

    Article  Google Scholar 

  • Lu Y, Lou Y, Cheng S, Zhang L, Hao D, Zhou Y, Zhang L (2016) How does regression test prioritization perform in real-world software evolution? In: Proceedings of the 38th IEEE/ACM international conference on software engineering (ICSE), IEEE, pp 535–546

  • MacCormack A, Rusnak J, Baldwin CY (2006) Exploring the structure of complex software designs: an empirical study of open source and proprietary code. Manag Sci 52(7):1015–1030

    Article  Google Scholar 

  • Melton H, Tempero E (2007) An empirical study of cycles among classes in java. Empir Softw Eng 12(4):389–415

    Article  Google Scholar 

  • Meng N, Kim M, McKinley KS (2013) Lase: locating and applying systematic edits by learning from examples. In: 2013 35th international conference on software engineering (ICSE), IEEE, pp 502–511

  • Mo R, Cai Y, Kazman R, Xiao L, Feng Q (2019) Architecture anti-patterns: automatically detectable violations of design principles. IEEE Trans Softw Eng 47(5):1008–1028

    Article  Google Scholar 

  • Oyetoyan TD, Cruzes DS, Conradi R (2013) A study of cyclic dependencies on defect profile of software components. J Syst Softw 86(12):3162–3182

    Article  Google Scholar 

  • Oyetoyan TD, Cruzes DS, Conradi R (2014) Transition and defect patterns of components in dependency cycles during software evolution. In: Proceedings of the software evolution week - IEEE conference on software maintenance, reengineering, and reverse engineering (CSMR-WCRE), IEEE, pp 283–292

  • Oyetoyan TD, Cruzes DS, Thurmann-Nielsen C (2015) A decision support system to refactor class cycles. In: Proceedings of the 31st IEEE international conference on software maintenance and evolution (ICSME), IEEE, pp 231–240

  • Perozzi B, Al-Rfou R, Skiena S (2014) Deepwalk: online learning of social representations. In: Proceedings of the 20th ACM SIGKDD international conference on knowledge discovery and data mining (KDD), ACM, pp 701–710

  • Peruma A, Simmons S, AlOmar EA, Newman CD, Mkaouer MW, Ouni A (2022) How do i refactor this? an empirical study on refactoring trends and topics in stack overflow. Empir Softw Eng 27(1):Article number: 11

  • Shah SMA, Dietrich J, McCartin C (2012) Making smart moves to untangle programs. In: Proceedings of the 16th european conference on software maintenance and reengineering (CSMR), IEEE, pp 359–364

  • Shah SMA, Dietrich J, McCartin C (2013) On the automation of dependency-breaking refactorings in java. In: Proceedings of the 29th IEEE international conference on software maintenance (ICSM), IEEE, pp 160–169

  • Sharir M (1981) A strong-connectivity algorithm and its applications in data flow analysis. Computers & Mathematics with Applications 7(1):67–72

    Article  MathSciNet  Google Scholar 

  • Sharma T, Suryanarayana G, Samarthyam G (2015) Challenges to and solutions for refactoring adoption: an industrial perspective. IEEE Softw 32(6):44–51

    Article  Google Scholar 

  • Snipes W, Karlekar S, Mo R (2018) A case study of the effects of architecture debt on software evolution effort. In: Proceedings of the 44th euromicro conference on software engineering and advanced applications (SEAA), IEEE, pp 400–403

  • Tan SH, Roychoudhury A (2015) relifix: automated repair of software regressions. In: Proceedings of the 37th IEEE/ACM IEEE international conference on software engineering (ICSE), IEEE, vol 1, pp 471–482

  • Terra R, Valente MT, Miranda S, Sales V (2018) Jmove: a novel heuristic and tool to detect move method refactoring opportunities. J Syst Softw 138:19–36

    Article  Google Scholar 

  • Tsantalis N, Chatzigeorgiou A (2009) Identification of move method refactoring opportunities. IEEE Trans Softw Eng 35(3):347–367

    Article  Google Scholar 

  • Tsantalis N, Chaikalis T, Chatzigeorgiou A (2018) Ten years of jdeodorant: lessons learned from the hunt for smells. In: Proceedings of the 25th IEEE international conference on software analysis, evolution and reengineering (SANER), IEEE, pp 4–14

  • Tsantalis N, Ketkar A, Dig D (2022) Refactoringminer 2.0. IEEE Trans Softw Eng 48(3):930–950

  • Xiao L, Cai Y, Kazman R, Mo R, Feng Q (2022) Detecting the locations and predicting the costs of compound architectural debts. IEEE Trans Softw Eng 48(9):3686–3715

    Article  Google Scholar 

  • Xu M (2021) Understanding graph embedding methods and their applications. SIAM Review 63(4):825–853

    Article  MathSciNet  Google Scholar 

  • Zazworka N, Vetro A, Izurieta C, Wong S, Cai Y, Seaman C, Shull F (2013) Comparing four approaches for technical debt identification. Softw Qual J 22:403–426

Download references

Acknowledgements

This work is supported by the National Natural Science Foundation of China (NSFC) under Grant No. 62172311.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Peng Liang.

Additional information

Communicated by: Andrea De Lucia.

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Feng, Q., Liu, S., Ji, H. et al. An empirical study of untangling patterns of two-class dependency cycles. Empir Software Eng 29, 56 (2024). https://doi.org/10.1007/s10664-023-10438-0

Download citation

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s10664-023-10438-0

Keywords

Navigation