Skip to main content
Log in

A new method for detecting various variants of GoF design patterns using conceptual signatures

  • Published:
Software Quality Journal Aims and scope Submit manuscript

Abstract

Software design patterns are well-known solutions for solving commonly occurring problems in software design. Detecting design patterns used in the code can help to understand the structure and behavior of the software, evaluate the quality of the software, and trace important design decisions. To develop and maintain a software system, we need sufficient knowledge of design decisions and software implementation processes. However, the acquisition of knowledge related to design patterns used in complex software systems is a challenging, time-consuming, and costly task. Therefore, using a suitable method to detect the design patterns used in the code reduces software development and maintenance costs. In this paper, we proposed a new method based on conceptual signatures to improve the accuracy of design pattern detection. So we used the conceptual signatures based on the purpose of patterns to detect the patterns’ instances that conform to the standard structure of patterns, and cover more instances of patterns’ variants and implementation versions of the patterns and improve the accuracy of pattern detection. The proposed method is a specific process in two main phases. In the first phase, the conceptual signature and detection formula for each pattern is determined manually. Then in the second phase, each pattern in the code is detected in a semi-automatic process using the conceptual signature and pattern detection formula. To implement the proposed method, we focused on GoF design patterns and their variants. We evaluated the accuracy of our proposed method on five open-source projects, namely, Junit v3.7, JHotDraw v5.1, QuickUML 2001, JRefactory v2.6.24, and MapperXML v1.9.7. Also, we performed our experiments on a set of source codes containing the instances of GoF design patterns’ variants for a comprehensive and fair evaluation. The evaluation results indicate that the proposed method has improved the accuracy of design pattern detection in the code.

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
Fig. 11
Fig. 12

Similar content being viewed by others

Notes

  1. http://sqlab.um.ac.ir/images/219/files/SourceCodes_Generated_by_PDBGTGT.zip

  2. https://sqlab.um.ac.ir/index.php?lang=en

References

  • Al-Obeidallah, M. G., Petridis, M., & Kapetanakis, S. (2018). A multiple phases approach for design patterns recovery based on structural and method signature features. International Journal of Software Innovation (IJSI), 6(3), 36–52.

    Article  Google Scholar 

  • Alex, B., Alan, B., & Ian, S. (2005). Automatic verification of design patterns in Java. In Proceedings of the 20th IEEE/ACM international Conference on Automated software engineering, Long Beach, CA, USA, (pp. 224–232). Association for Computing Machinery. https://doi.org/10.1145/1101908.1101943

  • Awny, A., Tian, Z., & Gongjun, Y. (2014). Rule-based detection of design patterns in program code. International Journal on Software Tools for Technology Transfer, 16(3), 315–334. https://doi.org/10.1007/s10009-013-0292-z

    Article  Google Scholar 

  • Bernardi, M. L., Cimitile, M., & Lucca, G. A. D. (2014). Design pattern detection using a DSL-driven graph matching approach. Journal of Software: Evolution and Process, 26, 1233–1266. https://doi.org/10.1002/smr.1674

    Article  Google Scholar 

  • Bernardi, M. L., Cimitile, M., Ruvo, G. D., Lucca, G. A. D., & Santone, A. (2015). Improving design patterns finder precision using a model checking approach. CAiSE Forum.

  • Binun, A. (2012). High accuracy design pattern detection. Ph.D thesis, Universit¨ats-und Landesbibliothek Bonn.

  • Chihada, A., Jalili, S., Hasheminejad, S. M. H., & Zangooei, M. H. (2014). Source code and design conformance, design pattern detection from source code by classification approach. Applied Soft Computing. https://doi.org/10.1016/j.asoc.2014.10.027

    Article  Google Scholar 

  • Cutting, D. (2016). Enhancing legacy software system analysis by combining behavioural and semantic information sources. Ph.D. thesis, University of East Anglia (UEA),

  • Cutting, D., & Noppen, J. (2014). Working with reverse engineering output for benchmarking and further use. In Proceedings of the 9th International Conference on Software Engineering Advances, (pp. 584–590). https://doi.org/10.13140/2.1.3032.9127

  • De Lucia, A., Deufemia, V., Gravino, C., & Risi, M. (2009). Design pattern recovery through visual language parsing and source code analysis. Journal of Systems and Software, 82(7), 1177–1193. https://doi.org/10.1016/j.jss.2009.02.012

    Article  Google Scholar 

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

  • Dong, J., Zhao, Y., & Peng, T. (2009). A review of design pattern mining techniques. International Journal of Software Engineering and Knowledge Engineering, 19, 823–855.

    Article  Google Scholar 

  • Dongjin, Y., Yanyan, Z., & Zhenli, C. (2015). A comprehensive approach to the recovery of design pattern instances based on sub-patterns and method signatures. Journal of Systems and Software, 103(C), 1–16. https://doi.org/10.1016/j.jss.2015.01.019

  • Dwivedi, A. K., Tirkey, A., & Rath, S. K. (2018). Software design pattern mining using classification-based techniques. Frontiers of Computer Science, 12(5), 908–922.

    Article  Google Scholar 

  • Dwivedi, A. K., Tirkey, A., & Rath, S. K. (2019). Applying learning-based methods for recognizing design patterns. Innovations in Systems and Software Engineering, 15(2), 87–100.

    Article  Google Scholar 

  • Fontana, F. A., Maggioni, S., & Raibulet, C. (2011a). Understanding the relevance of micro-structures for design patterns detection. Journal of Systems and Software, 84, 2334–2347. https://doi.org/10.1016/j.jss.2011.07.006

    Article  Google Scholar 

  • Fontana, F. A., Zanoni, M., & Maggioni, S. (2011b). Using design pattern clues to improve the precision of design pattern detection tools. Journal of Object Technology, 10(4), 1–31.

    Google Scholar 

  • Fontana, F. A., Maggioni, S., & Raibulet, C. (2013). Design patterns: A survey on their micro-structures. Journal of Software: Evolution and Process, 25(1), 27–52. https://doi.org/10.1002/smr.547

    Article  Google Scholar 

  • Gamma, E., Helm, R., Johnson, R. E., & Vlissides, J. (1995). Design patterns: Elements of reusable object-oriented software. Addison-Wesley Longman Publishing Co., Inc.

  • Ghulam, R., Ilka, P., & Patrick, M. (2010). Design pattern recovery based on annotations. Advances in Engineering Software, 41(4), 519–526. https://doi.org/10.1016/j.advengsoft.2009.10.014

    Article  MATH  Google Scholar 

  • Guéhéneuc, Y.-G. (2007). P-MARt: Pattern-like Micro Architecture Repository. 1st EuroPLoP Focus Group on Pattern Repositories.

  • Guéhéneuc, Y.-G., & Guyomarc’h, J.-Y., & Sahraoui, H. (2009). Improving design-pattern identification: A new approach and an exploratory study. Software Quality Journal, 18, 145–174. https://doi.org/10.1007/s11219-009-9082-y

    Article  Google Scholar 

  • Guéhéneuc, Y., & Antoniol, G. (2008). DeMIMA: A multilayered approach for design pattern identification. IEEE Transactions on Software Engineering, 34(5), 667–684.

    Article  Google Scholar 

  • Hayashi, S., Katada, J., Sakamoto, R., Kobayashi, T., & Saeki, M. (2008). Design pattern detection by using meta patterns. IEICE Transactions on Information and Systems, E91.D(4), 933-944. https://doi.org/10.1093/ietisy/e91-d.4.933

  • Imène, I., Nadia, B., & Hanêne, B.-A. (2015). Using metric-based filtering to improve design pattern detection approaches. Innovations in Systems and Software Engineering, 11(1), 39–53. https://doi.org/10.1007/s11334-014-0241-3

    Article  Google Scholar 

  • Jing, D., Yajing, Z., & Yongtao, S. (2009). A matrix-based approach to recovering design patterns. IEEE Transactions on Systems, Man and Cybernetics, Part A: Systems and Humans, 39(6), 1271–1282. https://doi.org/10.1109/tsmca.2009.2028012

    Article  Google Scholar 

  • Jing, D., Yongtao, S., & Yajing, Z. (2008). Design pattern detection by template matching In Proceedings of the 2008 ACM symposium on Applied computing, Fortaleza, Ceara, Brazil, (pp. 765–769). Association for Computing Machinery. https://doi.org/10.1145/1363686.1363864

  • Jonkers, H., Lankhorst, M., ter Doest, H., Arbab, F., Bosma, H., & Wieringa, R. (2006). Enterprise architecture: Management tool and blueprint for the organisation. Information Systems Frontiers, 8, 63–66. https://doi.org/10.1007/s10796-006-7970-2

    Article  Google Scholar 

  • Liu, C., van Dongen, B. F., Assy, N., & van der Aalst, W. M. (2018). A framework to support behavioral design pattern detection from software execution data. ENASE (pp. 65–76).

  • Lucia, A., Deufemia, V., Gravino, C., & Risi, M. (2009). Behavioral pattern identification through visual language parsing and code instrumentation. In Proceedings of the European Conference on Software Maintenance and Reengineering, CSMR (pp. 99–108). https://doi.org/10.1109/CSMR.2009.29

  • Lucia, A., Deufemia, V., Gravino, C., & Risi, M. (2010a). An Eclipse plug-in for the detection of design pattern instances through static and dynamic analysis. In Proceedings of the IEEE International Conference on Software Maintenance (pp. 1–6). https://doi.org/10.1109/ICSM.2010.5609707

  • Lucia, A. D., Deufemia, V., Gravino, C., & Risi, M. (2010b). Improving behavioral design pattern detection through model checking. In Software Maintenance and Reengineering (CSMR) (pp. 176–185). 14th European Conference on, IEEE. https://doi.org/10.1109/CSMR.2010.16

  • 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 (TOSEM), 26(4), 1–41.

    Article  Google Scholar 

  • Maggioni, S. (2010). Design pattern detection and software architecture reconstruction: An integrated approach based on software micro-structures. Ph.D. thesis, Universit`a degli Studi di Milano-Bicocca.

  • Markus von, D., & Steffen, B. (2011). Combining clustering and pattern detection for the reengineering of component-based software systems. In Proceedings of the joint ACM SIGSOFT conference -- QoSA and ACM SIGSOFT symposium -- ISARCS on Quality of software architectures -- QoSA and architecting critical systems -- ISARCS, Boulder, Colorado, USA (pp. 23–32). Association for Computing Machinery. https://doi.org/10.1145/2000259.2000265

  • Mayvan, B. B., Rasoolzadegan, A., & Yazdi, Z. G. (2017). The state of the art on design patterns: A systematic mapping of the literature. Journal of Systems and Software, 125(C), 93–118. https://doi.org/10.1016/j.jss.2016.11.030

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

  • Mayvan, B. B., Rasoolzadegan, A., & Ebrahimi, A. M. (2019). A new benchmark for evaluating pattern mining methods based on the automatic generation of testbeds. Information and Software Technology, 109, 60–79. https://doi.org/10.1016/j.infsof.2019.01.007

    Article  Google Scholar 

  • Olivier, K., Yann-Gaël, G., & Sylvie, H. (2010). Identification of design motifs with pattern matching algorithms. Information and Software Technology, 52(2), 152–168. https://doi.org/10.1016/j.infsof.2009.08.006

    Article  Google Scholar 

  • Pettersson, N., Löwe, W., & Nivre, J. (2010). Evaluation of accuracy in design pattern occurrence detection. IEEE Transactions on Software Engineering, 36(4), 575–590.

    Article  Google Scholar 

  • Philippow, I., Streitferdt, D., & Riebisch, M. (2003). Design pattern recovery in architectures for supporting product line development and application. In Modelling variability for object-oriented product lines (pp. 42–57)

  • Philippow, I., Streitferdt, D., Riebisch, M., & Naumann, S. (2004). An approach for reverse engineering of design patterns. Software & Systems Modeling, 4, 55–70.

    Article  Google Scholar 

  • Quatrani, T. (2000). Visual modelling with Rational Rose 2000 and UML: Addison-Wesley Longman Ltd.

  • Rasool, G. (2011). Customizable feature based design pattern recognition integrating multiple techniques. Ph.D. thesis, Technische Universit¨at Ilmenau, Germany,

  • Rasool, G., Ahmad, I., & Atif, M. (2013). A comparative study on results of design patterns recovery tools. World Applied Sciences Journal, 28, 1316–1321. https://doi.org/10.5829/idosi.wasj.2013.28.09.1284

    Article  Google Scholar 

  • Rasool, G., & Akhtar, H. (2019). Towards a catalog of design patterns variants. Paper presented at the 2019 International Conference on Frontiers of Information Technology (FIT).

  • Ren, W. H., & Zhao, W. (2012). An observer design-pattern detection technique. In Proceedings of the IEEE International Conference on Computer Science and Automation Engineering, 3, 544–547. https://doi.org/10.1109/CSAE.2012.6273011

  • Roeder, M. (2017). Precision, Recall and F1 measure. https://github.com/dice-group/gerbil/wiki/Precision,-Recall-and-F1-measure

  • Shi, N., & Olsson, R. A. (2006). Reverse engineering of design patterns from Java source code. Paper presented at the 21st IEEE/ACM International Conference on Automated Software Engineering (ASE'06), 18–22

  • Simone, R., Giuseppe, S., Michele, R., & Carmine, G. (2011). Clustering and lexical information support for the recovery of design pattern in source code. In Proceedings of the 2011 27th IEEE International Conference on Software Maintenance (pp. 500–503). IEEE Computer Society. https://doi.org/10.1109/icsm.2011.6080818

  • Thaller, H., Linsbauer, L., & Egyed, A. (2019). Feature maps: A comprehensible software representation for design pattern detection. 2019 IEEE 26th international conference on software analysis, evolution and reengineering (SANER) (pp. 207–217). IEEE.

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

  • Tsantalis, N., Chatzigeorgiou, A., Stephanides, G., & Halkidis, S. T. (2006). Design pattern detection using similarity scoring. IEEE transactions on software engineering, 32(11), 896–909.

    Article  Google Scholar 

  • Walter, Z. (1995). Relationships between design patterns. In Pattern languages of program design (Vol. 1, pp. 345–364): ACM Press/Addison-Wesley Publishing Co.

  • Wierda, A., Dortmans, E., & Somers, L. (2009). Pattern detection in object-oriented source code. In Software and Data Technologies, Berlin, Heidelberg (pp. 141-158): Springer Berlin Heidelberg. https://doi.org/10.1007/978-3-540-88655-6_11

  • Xiong, R., & Li, B. (2019). Accurate design pattern detection based on idiomatic implementation matching in java language context. 2019 IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER) (pp. 163-174): IEEE.

  • Yu, D., Zhang, P., Yang, J., Chen, Z., Liu, C., & Chen, J. (2018). Efficiently detecting structural design pattern instances based on ordered sequences. Journal of Systems and Software, 142, 35–56.

    Article  Google Scholar 

  • Yu, D., Zhang, Y., Ge, J., & Wu, W. (2013). From sub-patterns to patterns: An approach to the detection of structural design pattern instances by subgraph mining and merging. In 37th Annual Computer Software and Applications Conference (pp. 579–588). IEEE

  • Zanoni, M. (2012). Data mining techniques for design pattern detection. Ph.D thesis, Universit`a degli Studi di Milano-Bicocca.

  • Zazoni, M., Fontana, F. A., & Stella, F. (2015). On applying machine learning techniques for design pattern detection. Journal of Systems and Software, 103(C), 102–117. https://doi.org/10.1016/j.jss.2015.01.037

  • Zhang, P., Yu, D., & Wang, J. (2017). A degree-driven approach to design pattern mining based on graph matching. 2017 24th Asia-Pacific Software Engineering Conference (APSEC) (pp. 179–188). IEEE.

  • Zhu, H., Bayley, I., Shan, L., & Amphlett, R. (2009). Tool support for design pattern recognition at model level. In Proceedings of the 33rd Annual IEEE International Computer Software and Applications Conference, 1, 228–233. https://doi.org/10.1109/COMPSAC.2009.37

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Abbas Rasoolzadegan.

Additional information

Publisher's Note

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

Supplementary information

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Shahbazi, Z., Rasoolzadegan, A., Purfallah, Z. et al. A new method for detecting various variants of GoF design patterns using conceptual signatures. Software Qual J 30, 651–686 (2022). https://doi.org/10.1007/s11219-021-09576-9

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11219-021-09576-9

Keywords

Navigation