Abstract
Design patterns (DPs) represent an abstract design approach and are commonly reflected in software code. Design pattern detection (DPD) can help programmers quickly grasp the main structure of the code, thereby reducing the difficulty of software understanding. Micro-structures (MSs), are basic components of the code, have smaller granularity and clearer semantics, and can be used for the DPD task. This paper proposes a syntax-independent code design semantic representation method based on the heterogeneous information network (HIN). A representation and classification of micro-structures is given based on meta-paths of HIN, based on which a DP can be decomposed into MSs. The DPD procedure is then implemented through three steps of DP decomposition, MS matching and MS combination. The method is evaluated on three open-source systems with four other detection tools. The results show that our approach effectively detects DP instances and alleviates the variant problem, which also shows the great potential of applying network science methods to software engineering.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Kalliamvakou, E., Gousios, G., Blincoe, K., Singer, L., German, D.M., Damian, D.: The promises and perils of mining github. In: Proceedings of the 11th Working Conference on Mining Software Repositories, pp. 92–101 (2014)
Alexander, C.: A Pattern Language: Towns, Buildings, Construction. Oxford University Press, Oxford (1977)
Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design patterns: elements of reusable object-oriented software. Pearson Deutschland GmbH (1995)
Ampatzoglou, A., Charalampidou, S., Stamelos, I.: Research state of the art on GOF design patterns: a mapping study. J. Syst. Softw. 86(7), 1945–1964 (2013)
Mayvan, B.B., Rasoolzadegan, A., Yazdi, Z.G.: The state of the art on design patterns: a systematic mapping of the literature. J. Syst. Softw. 125, 93–118 (2017)
Maalej, W., Tiarks, R., Roehm, T., Koschke, R.: On the comprehension of program comprehension. ACM Trans. Softw. Eng. Methodol. (TOSEM) 23(4), 1–37 (2014)
Lauder, A., Kent, S.: Precise visual specification of design patterns. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 114–134. Springer, Heidelberg (1998). https://doi.org/10.1007/BFb0054089
Fontana, F.A., Caracciolo, A., Zanoni, M.: DPB: a benchmark for design pattern detection tools. In: 2012 16th European Conference on Software Maintenance and Reengineering, pp. 235–244. IEEE (2012)
Yarahmadi, H., Hasheminejad, S.M.H.: Design pattern detection approaches: a systematic review of the literature. Artif. Intell. Rev. 53, 5789–5846 (2020)
Sun, Y., Han, J.: Mining heterogeneous information networks: a structural analysis approach. ACM SIGKDD Explor. Newsl. 14(2), 20–28 (2013)
Dong, J., Sun, Y., Zhao, Y.: Design pattern detection by template matching. In: Proceedings of the 2008 ACM Symposium on Applied computing, pp. 765–769 (2008)
Pradhan, P., Dwivedi, A.K., Rath, S.K.: Detection of design pattern using graph isomorphism and normalized cross correlation. In: 2015 Eighth International Conference on Contemporary Computing (IC3), pp. 208–213. IEEE (2015)
Rao, R.S.: A review on design pattern detection. Int. J. Eng. Res. Technol. 8(11), 756–762 (2019)
Al-Obeidallah, M.G., Petridis, M., Kapetanakis, S.: A structural rule-based approach for design patterns recovery. In: Software Engineering Research, Management and Applications, pp. 107–124 (2018)
Kirasić, D., Basch, D.: Ontology-based design pattern recognition. In: Lovrek, I., Howlett, R.J., Jain, L.C. (eds.) KES 2008. LNCS (LNAI), vol. 5177, pp. 384–393. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-85563-7_50
Xiong, R., Li, B.: Accurate design pattern detection based on idiomatic implementation matching in java language context. In: 2019 IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER), pp. 163–174. IEEE (2019)
Dubey, S.K., Sharma, A., Rana, A.: Comparison study and review on object-oriented metrics. Global J. Comp. Sci. Technol. 12(7), 39–48 (2012)
Issaoui, I., Bouassida, N., Ben-Abdallah, H.: Using metric-based filtering to improve design pattern detection approaches. Innov. Syst. Softw. Eng. 11, 39–53 (2015)
Hussain, S., Keung, J., Sohail, M.K., Khan, A.A., Ilahi, M.: Automated framework for classification and selection of software design patterns. Appl. Soft Comput. 75, 1–20 (2019)
Dwivedi, A.K., Tirkey, A., Rath, S.K.: Software design pattern mining using classification-based techniques. Front. Comp. Sci. 12, 908–922 (2018)
Nazar, N., Aleti, A., Zheng, Y.: Feature-based software design pattern detection. J. Syst. Softw. 185, 111179 (2022)
Thaller, H., Linsbauer, L., Egyed, A.: Feature maps: a comprehensible software representation for design pattern detection. In: 2019 IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER), pp. 207–217. IEEE (2019)
Ardimento, P., Aversano, L., Bernardi, M.L., Cimitile, M.: Design patterns mining using neural sub-graph matching. In: Proceedings of the 37th ACM/SIGAPP Symposium on Applied Computing, pp. 1545-1553. ACM, New York (2022). https://doi.org/10.1145/3477314.3507073
Gil, J., Maman, I.: Micro patterns in java code. In: Proceedings of the 20th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 97–116 (2005)
Kim, S., Pan, K., Whitehead Jr, E.J.: Micro pattern evolution. In: Proceedings of the 2006 International Workshop on Mining Software Repositories, pp. 40–46 (2006)
Fontana, F.A., Maggioni, S., Raibulet, C.: Understanding the relevance of micro-structures for design patterns detection. J. Syst. Softw. 84(12), 2334–2347 (2011)
Smith, J.M., Stotts, D.: Elemental design patterns: a formal semantics for composition of oo software architecture. In: 27th Annual NASA Goddard/IEEE Software Engineering Workshop, Proceedings, pp. 183–190. IEEE (2002)
Fontana, F.A., Zanoni, M., Maggioni, S.: Using design pattern clues to improve the precision of design pattern detection tools. J. Object Technol. 10(4), 1–31 (2011)
Smith, J.M., Stotts, D.: SPQR: flexible automated design pattern extraction from source code. In: 18th IEEE International Conference on Automated Software Engineering, Proceedings, pp. 215–224. IEEE (2003)
Fontana, F.A., Zanoni, M.: A tool for design pattern detection and software architecture reconstruction. Inf. Sci. 181(7), 1306–1324 (2011)
Arcelli, F., Cristina, L.: Enhancing software evolution through design pattern detection. In: Third International IEEE Workshop on Software Evolvability 2007, pp. 7–14. IEEE (2007)
Thaller, H.: Towards Deep Learning Driven Design Pattern Detection/submitted by Hannes Thaller. Ph.D. thesis, Universität Linz (2016)
Nickel, U., Niere, J., Zündorf, A.: The fujaba environment. In: Proceedings of the 22nd International Conference on Software Engineering, pp. 742–745 (2000)
Milo, R., Shen-Orr, S., Itzkovitz, S., Kashtan, N., Chklovskii, D., Alon, U.: Network motifs: simple building blocks of complex networks. Science 298(5594), 824–827 (2002). https://doi.org/10.1126/science.298.5594.824
Sun, Y., Yu, Y., Han, J.: Ranking-based clustering of heterogeneous information networks with star network schema. In: Proceedings of the 15th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 797–806 (2009)
Han, J.: Mining heterogeneous information networks by exploring the power of links. In: Gama, J., Costa, V.S., Jorge, A.M., Brazdil, P.B. (eds.) DS 2009. LNCS (LNAI), vol. 5808, pp. 13–30. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-04747-3_2
Shi, C., Li, Y., Zhang, J., Sun, Y., Philip, S.Y.: A survey of heterogeneous information network analysis. IEEE Trans. Knowl. Data Eng. 29(1), 17–37 (2016)
Sun, Y., Han, J., Yan, X., Yu, P.S., Wu, T.: Pathsim: meta path-based top-k similarity search in heterogeneous information networks. Proc. VLDB Endow. 4(11), 992–1003 (2011)
Lu, T.: Dataset for: Design pattern representation and detection based on heterogeneous information network. https://github.com/lt3355/Dataset4HIN-DPD-master. Accessed 18 Apr 2024
Kemper, C., Kemper, C.: Getting to know neo4j. Beginning Neo4j pp. 13–23 (2015)
Francis, N., et al.: Cypher: an evolving query language for property graphs. In: Proceedings of the 2018 International Conference on Management of Data, pp. 1433–1445 (2018)
Węgrzynowicz, P., Stencel, K.: Relaxing queries to detect variants of design patterns. In: 2013 Federated Conference on Computer Science and Information Systems, pp. 1571–1578. IEEE (2013)
Pawlak, R., Monperrus, M., Petitprez, N., Noguera, C., Seinturier, L.: Spoon: a library for implementing analyses and transformations of java source code. Softw. Pract. Exp. 46, 1155–1179 (2015). https://doi.org/10.1002/spe.2346. https://hal.archives-ouvertes.fr/hal-01078532/document
Kniesel, G., et al.: Dpdx–towards a common result exchange format for design pattern detection tools. In: 2010 14th European Conference on Software Maintenance and Reengineering, pp. 232–235. IEEE (2010)
Guéhéneuc, Y.G.: P-mart: Pattern-like micro architecture repository. In: Proceedings of the 1st EuroPLoP Focus Group on Pattern Repositories, pp. 1–3 (2007)
Rasool, G., Mäder, P.: A customizable approach to design patterns recognition based on feature types. Arab. J. Sci. Eng. 39, 8851–8873 (2014)
Tsantalis, N., Chatzigeorgiou, A., Stephanides, G., Halkidis, S.T.: Design pattern detection using similarity scoring. IEEE Trans. Softw. Eng. 32(11), 896–909 (2006)
Bernardi, M.L., Cimitile, M., Di Lucca, G.: Design pattern detection using a DSL-driven graph matching approach. J. Softw. Evol. Process 26(12), 1233–1266 (2014)
Acknowledgement
The authors would like to express our great appreciation to the editors and reviewers. This work is supported by National Natural Science Foundation of China (NSFC) (No. 62006198), Chongqing Innovative Research Groups (No. CXQT21005) and the Fundamental Research Funds for the Central Universities (No. SWU-XDJH202303).
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2024 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Lu, T., Wang, X., Jia, T. (2024). Design Pattern Representation and Detection Based on Heterogeneous Information Network. In: Achilleos, A., Fuentes, L., Papadopoulos, G.A. (eds) Reuse and Software Quality. ICSR 2024. Lecture Notes in Computer Science, vol 14614. Springer, Cham. https://doi.org/10.1007/978-3-031-66459-5_5
Download citation
DOI: https://doi.org/10.1007/978-3-031-66459-5_5
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-66458-8
Online ISBN: 978-3-031-66459-5
eBook Packages: Computer ScienceComputer Science (R0)