Skip to main content
Log in

Probabilistic detection of GoF design patterns

  • Published:
The Journal of Supercomputing Aims and scope Submit manuscript

Abstract

Detecting design patterns from source code of software systems can help to understand the structure and the behavior of the software systems. The better understanding of software systems is helpful in reengineering and refactoring. As software progression, refactoring has become more valuable. One way to reduce the refactoring costs is to detect design patterns. The key criteria for accurately detecting design patterns is signatures. Achieving fine signatures is not an easy forward task. Instead of improving signatures, more accurate detection can be achieved by having probabilistic viewpoints. Since each of the design patterns has variants or may be implemented differently, having a probabilistic approach in detection can increase coverage as well as help in software refactoring. In this study, the main purpose is to identify the design patterns in source code with a non-crisp approach and measuring the possibility of the presence of the design patterns in the source code. Considering main body of design patterns and their corresponding signatures, design patterns are represented as appropriate features. We try to get features from design pattern signatures that do not change in the face of variations that occur during implementation. Then, through these features, the probability of presence of the roles forming the design patterns is determined, using neural network and regression analysis. After this step, using probabilistic graphical models the probability of presenting design patterns in source code is measured. The results of the proposed method show the similarity of each code to the design patterns in the range between 0 and 1. The results of other valid methods are a subset of the results of proposed method. Results that are 50% to 100% similar to the design patterns are presented in the evaluation section.

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

Similar content being viewed by others

Data availability

All the datasets analyzed during the current study are available from the corresponding author on reasonable request.

References

  1. Dong J, Zhao Y, Peng T (2009) a Review of design pattern mining techniques. Int J Softw Eng Knowl Eng 19(06):823–855. https://doi.org/10.1142/S021819400900443X

    Article  Google Scholar 

  2. Rasool G, Streitfdert D (2011) A survey on design pattern recovery techniques. J Comput Sci Issues 8(6):251–260

    Google Scholar 

  3. Mayvan BB, Rasoolzadegan A, Yazdi ZG (2016) The state of the art on design patterns: a systematic mapping of the literature, J. Syst. Softw. 37. https://doi.org/10.1016/j.jss.2016.11.030

  4. Ampatzoglou A, Chatzigeorgiou A, Charalampidou S, Avgeriou P (2015) The effect of GoF design patterns on stability: a case study. IEEE Trans Softw Eng 41(8):781–802. https://doi.org/10.1109/TSE.2015.2414917

    Article  Google Scholar 

  5. Chihada A, Jalili S, Hasheminejad SMH, Zangooei MH (2015) design pattern detection from source code by classification approach. Appl Soft Comput J 26:357–367. https://doi.org/10.1016/j.asoc.2014.10.027

    Article  Google Scholar 

  6. Yu D, Zhang Y, Chen Z (2015) A comprehensive approach to the recovery of design pattern instances based on sub-patterns and method signatures. J Syst Softw 103:1–16. https://doi.org/10.1016/j.jss.2015.01.019

    Article  Google Scholar 

  7. Ren W, Zhao W (2012) An observer design-pattern detection technique, CSAE 2012—Proceedings, 2012 IEEE Int Conf Comput Sci Autom Eng, 3: 544–547, https://doi.org/10.1109/CSAE.2012.6273011

  8. Shi N (2005) Reverse engineering of design patterns for high performance computing, Patterns High Perform. Comput, pp. 1–6, 2005, [Online]. Available: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.137.782&rep=rep1&type=pdf

  9. Travassos GH, Shull F, Fredericks M, Basili VR (1999) Detecting defects in object oriented designs: using reading techniques to increase software quality. Acm Sigplan Not 34(10):47–56. https://doi.org/10.1145/320384.320389

    Article  Google Scholar 

  10. Arcelli Fontana F, Zanoni M (2011) A tool for design pattern detection and software architecture reconstruction. Inf Sci (Ny) 181(7):1306–1324. https://doi.org/10.1016/j.ins.2010.12.002

    Article  Google Scholar 

  11. Kludt SR (1996) Metrics and models in software quality engineering—kan, sh. J Prod Innov Manag 13(2):182–183. https://doi.org/10.1016/0967-0661(96)81493-6

    Article  Google Scholar 

  12. Gamma E, Helm R, Johnson R, Vlissides J (1996) Design Patterns: Elements of Reusable Software

  13. Ampatzoglou A, Charalampidou S, Stamelos I (2013) Research state of the art on GoF design patterns: a mapping study. J Syst Softw 86(7):1945–1964

    Article  Google Scholar 

  14. Bafandeh Mayvan B, Rasoolzadegan A (2017) Design pattern detection based on the graph theory. Knowledge-Based Syst 120:211–225. https://doi.org/10.1016/j.knosys.2017.01.007

    Article  Google Scholar 

  15. De Lucia A, Deufemia V, Gravino C, Risi M (2009) Design pattern recovery through visual language parsing and source code analysis. J Syst Softw 82(7):1177–1193. https://doi.org/10.1016/j.jss.2009.02.012

    Article  Google Scholar 

  16. Rasool G, Philippow I, Mäder P (2010) Design pattern recovery based on annotations. Adv Eng Softw 41(4):519–526. https://doi.org/10.1016/j.advengsoft.2009.10.014

    Article  MATH  Google Scholar 

  17. Nazar N, Aleti A, Zheng Y (2022) Feature-based software design pattern detection. J Syst Softw 185:111179

    Article  Google Scholar 

  18. Dong J, Zhao Y (2009) Sun Y (2009) A matrix-based approach to recovering design patterns. IEEE Trans Syst Man Cybern Part A Syst Humans 39(6):1271–1282. https://doi.org/10.1109/TSMCA.2009.2028012

    Article  Google Scholar 

  19. Liu C (2021) A general framework to detect design patterns by combining static and dynamic analysis techniques. Int J Softw Eng Knowl Eng 31(1):21–54. https://doi.org/10.1142/S0218194021400027

    Article  Google Scholar 

  20. Rasool G, Mader P (2011) Flexible design pattern detection based on feature types, 2011 26th IEEE/ACM Int Conf Autom. Softw Eng (ASE 2011), 243–252, 2011, https://doi.org/10.1109/ASE.2011.6100060

  21. Thongrak M, Vatanawood W (2014) Detection of design pattern in class diagram using ontology, 2014 International Computer Science and Engineering Conference, ICSEC. 97–102. https://doi.org/10.1109/ICSEC.2014.6978176

  22. De Lucia A, Deufemia V, Gravino C, Risi M (2009) Behavioral Pattern Identification through Visual Language Parsing and Code Instrumentation, 2009 13th Eur Conf Softw Maint Reengineering, https://doi.org/10.1109/CSMR.2009.29

  23. Shahbazi Z, Rasoolzadegan A, Purfallah Z, Jafari Horestani S (2021) A new method for detecting various variants of GoF design patterns using conceptual signatures, Softw Qual J, https://doi.org/10.1007/s11219-021-09576-9

  24. Alnusair A, Zhao T, Yan G (2014) Rule-based detection of design patterns in program code. Int J Softw Tools Technol Transf 16(3):315–334. https://doi.org/10.1007/s10009-013-0292-z

    Article  Google Scholar 

  25. Hayashi S, Katada J, Sakamoto R, Kobayashi T (2008) Design pattern detection by using meta patterns. IEICE—Trans Inf Syst 4:933–944

    Article  Google Scholar 

  26. Cointe HAP, Jussien YGN, Cedex N (2001) Instantiating and detecting design patterns : putting bits and pieces together, Proc 16th Annu Int Conf Autom Softw Eng (ASE 2001), pp. 166–173

  27. Guéhéneuc YG, Antoniol G (2008) DeMIMA: a multilayered approach for design pattern identification. IEEE Trans Softw Eng 34(5):667–684. https://doi.org/10.1109/TSE.2008.48

    Article  Google Scholar 

  28. Sahraoui H, Zaidi F (2004) Fingerprinting Design Patterns, 11th Work Conf Reverse Eng, pp. 1–10

  29. von Detten M, Becker S (2011) Combining clustering and pattern detection for the reengineering of component-based software systems, Proc Jt ACM SIGSOFT Conf.—QoSA ACM SIGSOFT Symp—ISARCS Qual. Softw. Archit.—QoSA Archit Crit Syst—ISARCS—QoSA-ISARCS ’11, p. 23, https://doi.org/10.1145/2000259.2000265

  30. Oruc M, Akal F, Sever H (2016) Detecting Design Patterns in Object-Oriented Design Models by Using a Graph Mining Approach, 2016 4th Int Conf Softw Eng Res Innov, pp. 115–121, https://doi.org/10.1109/CONISOFT.2016.26.

  31. Issaoui I, Bouassida N, Ben-Abdallah H (2014) Using metric-based filtering to improve design pattern detection approaches. Innov Syst Softw Eng 11(1):39–53. https://doi.org/10.1007/s11334-014-0241-3

    Article  Google Scholar 

  32. Lanza M, Marinescu R, Ducasse S (2006) Object-Oriented Metrics in Practice. Springer. https://doi.org/10.1007/3-540-39538-5

  33. Blewitt A, Bundy A, Stark I (2005) Automatic Verification of Design Patterns in Java Categories and Subject Descriptors, ASE ’05 Proc 20th IEEE/ACM Int Conf Autom Softw Eng, pp. 224–232

  34. Niere J, Sch W, Wadsack JP, Wendehals L, Welsh J (2002) Towards Pattern-Based Design Recovery, ICSE ’02 Proc 24th Int Conf Softw Eng, pp. 338–348

  35. Jamali N, Sadegheih A, Lotfi MM, Wood LC, Ebadi MJ (2021) Estimating the depth of anesthesia during the induction by a novel adaptive neuro-fuzzy inference system: a case study. Neural Process Lett 53(1):131–175. https://doi.org/10.1007/s11063-020-10369-7

    Article  Google Scholar 

  36. Yu D, Zhang Y, Chen Z (2015) A comprehensive approach to the recovery of design pattern instances based on sub-patterns and method signatures, J Syst Softw, 103(C): 1–16, 2015, https://doi.org/10.1016/jjss.2015.01.019

  37. Issaoui I, Bouassida N, Ben-abdallah H (2016) Predicting the existence of design patterns based on semantics and metrics. Int Arab J Inf Technol 13(2):310–319. https://doi.org/10.5772/30826

    Article  Google Scholar 

  38. Ferenc R, Beszédes Á, Fülöp L, Lele J (2005) Design pattern mining enhanced by machine learning. IEEE Int Conf Softw Maintenance ICSM 2005:295–304. https://doi.org/10.1109/ICSM.2005.40

    Article  Google Scholar 

  39. 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 J Softw Eng Appl 7(7):983–998. https://doi.org/10.4236/jsea.2014.712086

    Article  Google Scholar 

  40. Bafandeh Mayvan B, Rasoolzadegan A, Javan Jafari A (2020) Bad smell detection using quality metrics and refactoring opportunities, J Softw Evol Process, 32(8): 1–33, 2020, https://doi.org/10.1002/smr.2255

  41. Nazar N, Aleti A, Zheng Y (2020) Feature-Based Software Design Pattern Detection, pp. 1–15, https://doi.org/10.1016/j.jss.2021.111179

  42. Tsantalis N, Chatzigeorgiou A, Stephanides G, Halkidis ST (2006) Design pattern detection using similarity scoring. IEEE Trans Softw Eng 32(11):896–909. https://doi.org/10.1109/TSE.2006.112

    Article  Google Scholar 

  43. Dwivedi AK, Tirkey A, Ray RB, Rath SK (2017) Software design pattern recognition using machine learning techniques, in IEEE Region 10 Annual International Conference, Proceedings/TENCON, 2017, pp. 222–227. https://doi.org/10.1109/TENCON.2016.7847994

  44. Zanoni M, Perin F, Fontana FA, Viscusi G (2014) Design pattern detection using a DSL-driven graph matching approach. J Softw Evol Process 26(12):1172–1192. https://doi.org/10.1002/smr

    Article  Google Scholar 

  45. Chihada A, Jalili S, Hasheminejad SMH, Zangooei MH (2015) Source code and design conformance, design pattern detection from source code by classification approach. Appl Soft Comput J 26:357–367. https://doi.org/10.1016/j.asoc.2014.10.027

    Article  Google Scholar 

  46. Nazar N, Aleti A, Zheng Y (2020) Feature-Based Software Design Pattern Detection, https://doi.org/10.1016/j.jss.2021.111179.

  47. Rasool G, Akhtar H (2019) Towards a catalog of design patterns variants,” Proc—2019 Int Conf Front Inf Technol FIT 2019, 156–161, https://doi.org/10.1109/FIT47737.2019.00038.

  48. Mayvan BB, Rasoolzadegan A, Ebrahimi AM (2019) A new benchmark for evaluating pattern mining methods based on the automatic generation of Testbeds, Inf Softw Technol

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Abbas Rasoolzadegan.

Ethics declarations

Conflict of interest

The authors have no conflicts of interest to declare. All co-authors have seen and agree with the contents of the manuscript and there is no financial interest to report. We certify that the submission is original work.

Additional information

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 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

Bozorgvar, N., Rasoolzadegan, A. & Harati, A. Probabilistic detection of GoF design patterns. J Supercomput 79, 1654–1682 (2023). https://doi.org/10.1007/s11227-022-04718-7

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11227-022-04718-7

Keywords

Navigation