Skip to main content
Log in

Detecting design patterns: a hybrid approach based on graph matching and static analysis

  • Published:
Information Technology and Management Aims and scope Submit manuscript

Abstract

Knowledge and understanding about system design are very important for the development and maintenance of any software system due to certain deadlines and frequent changes in requirements and environment. However, it is a very difficult task to analyse design automatically. Design patterns give standard solutions to common design problems. It is very helpful to find existence of such patterns in the source code. It will reduce effort and time required in understanding and thus in the maintenance activity. In this paper we propose a tool DPDT for detecting design patterns from system software. We use graph matching process to find exact instances of design patterns mapped to system software. In graph matching structural aspects are considered. After that static facts of software systems and design patterns are used to reduce the number of false positives. We evaluate our result on two well-known open source software: JHotDraw and JUnit and compared the result of DPDT with existing tools (Sempatrec, DPF, SSA, DeMIMA, and Depatos) of design patterns detection. It is found that for proxy design patterns our tool out performs the all other tools. Further, for few design patterns it is giving moderate results while other tools did not consider those design patterns.

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

Similar content being viewed by others

Data availability

Yes.

Code availability

Yes.

References

  1. Gamma E (1995) Design patterns: elements of reusable object-oriented software. Pearson Education India

  2. Vassallo C, Panichella S, Palomba F et al (2020) How developers engage with static analysis tools in different contexts. Empir Software Eng 25:1419–1457. https://doi.org/10.1007/s10664-019-09750-5

    Article  Google Scholar 

  3. http://www.jhotdraw.org/

  4. http://www.junit.org/

  5. Al-Obeidallah MG, Petridis M, Kapetanakis S (2016) A survey on design pattern detection approaches. Int J Softw Eng (IJSE) 7(3):41–59

    Google Scholar 

  6. Dong J, Zhao Y, Peng T (2007) Architecture and design pattern discovery techniques-a review. In Software Engineering Research and Practice 621–627

  7. Rasool G, Streitfdert D (2011) A survey on design pattern recovery techniques. Int J Computer Sci Issues (IJCSI) 8(6):251

    Google Scholar 

  8. Kramer C, Prechelt L (1996) Design recovery by automated search for structural design patterns in object-oriented software. Proceedings of WCRE '96: 4rd Working Conference on Reverse Engineering, Monterey, CA, USA: 208–215, Doi: https://doi.org/10.1109/WCRE.1996.558905

  9. Seemann J, von Gudenberg JW (1998) Pattern-based design recovery of Java software. ACM SIGSOFT Softw Eng Notes 23(6):10–16

    Article  Google Scholar 

  10. Blondel VD, Gajardo A, Heymans M, Senellart P, Dooren VP (2004) A measure of similarity between graph vertices: applications to synonym extraction and web searching. SIAM Rev 46(4):647–666

    Article  Google Scholar 

  11. Tsantalis N, Chatzigeorgiou A, Stephanides G, Halkidis ST (2006) Design pattern detection using similarity scoring. IEEE Trans Softw Eng 32(11):896–909

    Article  Google Scholar 

  12. Dong J, Sun Y, Zhao, Y (2008) Design pattern detection by template matching. In Proceedings of the 2008 ACM symposium on Applied computing: 765–769

  13. Dong J, Lad DS, Zhao Y (2007) DP-Miner: Design pattern discovery using matrix. In 14th Annual IEEE International Conference and Workshops on the Engineering of Computer-Based Systems (ECBS'07) (pp. 371–380). IEEE

  14. Singh J, Gupta M (2019) Design pattern detection using dpdetect algorithm. Int J Innov Technol Exploring Eng (IJITEE) 8(7)

  15. Wenzel S, Kelter U (2006) Model-driven design pattern detection using difference calculation. In Workshop on Pattern Detection for Reverse Engineering

  16. Bernardi ML, Cimitile M, Di Lucca G (2014) Design pattern detection using a DSL-driven graph matching approach. J Softw: Evol Process 26(12):1233–1266

    Google Scholar 

  17. Gupta M (2011) Design pattern mining using greedy algorithm for multilabeled graphs. Int J Inf Commun Technol, Indersci 3(4):314–323

    Google Scholar 

  18. Pande A, Gupta M (2010) Design pattern detection using graph matching. Int J Computer Eng Inf Technol 15(20):59–64

    Google Scholar 

  19. Rao RS, Gupta M (2013) Design pattern detection by greedy algorithm using inexact graph matching. Int J Eng Res Technol 2(10):3658–3664

    Google Scholar 

  20. Gupta M, Pande A (2011) Design patterns mining using subgraph isomorphism: relational view. Int J Softw Eng Its Appl 5(2):47–56

    Google Scholar 

  21. Antoniol G, Fiutem R, Cristoforetti L (1998) Design pattern recovery in object-oriented software. Proceedings. 6th International Workshop on Program Comprehension. IWPC'98 (Cat. No.98TB100242), Ischia, Italy, 1998 153-160, Doi: https://doi.org/10.1109/WPC.1998.693342

  22. Keller RK, Schauer R, Robitaille S, Pagé P (1999) Pattern-based reverse-engineering of design components. In Proceedings of the 21st international conference on Software engineering: 226–235

  23. Lee H, Youn H, Lee, E (2007) Automatic detection of design pattern for reverse engineering. 5th ACIS International Conference on Software Engineering Research, Management & Applications (SERA 2007), Busan, Korea (South), 2007: 577–583, doi: https://doi.org/10.1109/SERA.2007.58

  24. Rasool G, Philippow I, Mäder P (2010) Design pattern recovery based on annotations. Adv Eng Softw 41(4):519–526

    Article  Google Scholar 

  25. Stencel K. Wegrzynowicz P (2008) Detection of diverse design pattern variants. APSEC '08: Proceedings of the 2008 15th Asia-Pacific Software Engineering ConferenceDecember 2008: 25–32. https://doi.org/10.1109/APSEC.2008.67

  26. Vokác M (2006) An efficient tool for recovering Design Patterns from C++ Code. J Object Technol 5(1):139–157

    Article  Google Scholar 

  27. Ferenc R, Beszedes A, Fulop L, Lele J (2005) Design pattern mining enhanced by machine learning. In 21st IEEE International Conference on Software Maintenance (ICSM'05): 295–304

  28. Uchiyama S, Kubo A, Washizaki H, Fukazawa Y (2014) Detecting design patterns in object-oriented program source code by using metrics and machine learning. J Softw Eng Appl 7(12):983

    Article  Google Scholar 

  29. Wang W. Tzerpos V (2005) Design pattern detection in Eiffel systems. 12th Working Conference on Reverse Engineering (WCRE'05), Pittsburgh, PA, USA, 2005: 10–174, doi: https://doi.org/10.1109/WCRE.2005.14

  30. Mhawish MY, Gupta M (2020) Software metrics and tree-based machine learning algorithms for distinguishing and detecting similar structure design patterns. SN Appl Sci 2(1):11. https://doi.org/10.1007/s42452-019-1815-3

    Article  Google Scholar 

  31. Shi N, Olsson R A (2006) Reverse engineering of design patterns from java source code. 21st IEEE/ACM International Conference on Automated Software Engineering (ASE'06), Tokyo, Japan, 2006: 123–134. doi: https://doi.org/10.1109/ASE.2006.57

  32. Alnusair A, Zhao T, Yan G (2014) Rule-based detection of design patterns in program code. Int J Softw Tools Technol Transfer 16(3):315–334

    Article  Google Scholar 

  33. Brown K (1996) Design reverse-engineering and automated design-pattern detection in Smalltalk. North Carolina State University at Raleigh, USA

    Google Scholar 

  34. Gupta M, Pande A, Tripathi AK (2011) Design pattern detection using SOP expressions for graphs. ACM SIGSOFT Softw Eng Notes 36(1):01–05

    Article  Google Scholar 

  35. Barbudo R, Ramirez A, Servant F, Romero J (2021) GEML: a grammar-based evolutionary machine learning approach for design-pattern detection. J Syst Softw 175:110919

    Article  Google Scholar 

  36. Liu C (2021) A general framework to detect design patterns by combining static and dynamic analysis techniques. Int J Softw Eng Knowl Eng 31(01):21–54

    Article  Google Scholar 

  37. Lucia. A.D., Deufemia, V., Gravino, C., Risi, M., (2018) Detecting the Behavior of Design Patterns through Model Checking and Dynamic Analysis, ACM Transactions on Software Engineering and Methodology, Volume 26, Issue 4, Article No. 13, pp1-41, https://doi.org/10.1145/3176643

  38. Cosmats Institute of Information Technology http://research.citi.lahaore.edu.pk/Groups/SERC/DesignPattern.aspx [January1, 2014]

  39. Guéhéneuc Y G (2007) P-mart: Pattern-like micro architecture repository. Proceedings of the 1st EuroPLoP Focus Group on pattern repositories, 1–3

  40. Yu D, Zhang P, Yang J, Chen Z, Liu C, Chen J (2018) Efficiently detecting structural design pattern instances based on ordered sequences. J Syst Softw 142:35–56

    Article  Google Scholar 

  41. Guéhéneuc YG, Antoniol G (2008) Demima: a multilayered approach for design pattern identification. IEEE Trans Software Eng 34(5):667–684

    Article  Google Scholar 

  42. Khwaja S, Alshayeb (2016) Survey on software design pattern specification languages, ACM Computer Survey 49(1). Doi: https://doi.org/10.1145/2926966

Download references

Author information

Authors and Affiliations

Authors

Contributions

JS: Methodology, Software, writing-original draft preparation, validation, visualization, formal analysis MG: Conceptualization, supervision, writing-reviewing and editing; SRC, GB: writing-reviewing and editing.

Corresponding author

Correspondence to Manjari Gupta.

Ethics declarations

Conflict of interest

There is no conflict among authors.

Human or animal rights

This article does not contain any studies with human or animal subjects performed by any of the authors.

Additional information

Publisher's Note

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

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Singh, J., Chowdhuri, S.R., Bethany, G. et al. Detecting design patterns: a hybrid approach based on graph matching and static analysis. Inf Technol Manag 23, 139–150 (2022). https://doi.org/10.1007/s10799-021-00339-3

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10799-021-00339-3

Keywords

Navigation