A comprehensive approach to the recovery of design pattern instances based on sub-patterns and method signatures

We present a comprehensive and elaborative approach for detecting ALL GoF patterns.We define 15 sub-patterns and identify their instances through subgraph discovery.We merge sub-pattern instances based on prime number composition and joint classes.We show the Structural Feature Models and Signature Templates for all GoF patterns.An extensive experiment was conducted with nine open sources and ALL GoF patterns. Design patterns are formalized best practices that address concerns related to high-level structures for applications being developed. The efficient recovery of design pattern instances significantly facilitates program comprehension and software reengineering. However, the recovery of design pattern instances is not a straightforward task. In this paper, we present a novel comprehensive approach to the recovery of instances of 23 GoF design patterns from source codes. The key point of the approach lies in that we consider different design pattern instances consist of some commonly recurring sub-patterns that are easier to be detected. In addition, we focus not only on the class relationship, but also on the characteristics of underlying method signatures in classes. We first transform the source codes and predefined GoF patterns into graphs, with the classes as nodes and the relationships as edges. We then identify the instances of sub-patterns that would be the possible constituents of pattern instances by means of subgraph discovery. The sub-pattern instances are further merged by the joint classes to see if the collective matches one of the predefined patterns. Finally, we compare the behavioral characteristics of method invocation with the predefined method signature templates of GoF patterns to obtain the final pattern instances directly. Compared with existing approaches, we integrate and improve some of the previous ideas and put forward a comprehensive and elaborative approach also based on our own ideas. We detect sub-patterns via graph isomorphism based on prime number composition and the joint classes to reduce the search space. Meanwhile, we employ the method signatures to investigate the behavioral features to avoid choosing the test cases with full code coverage. The results of the extensive experiments on recovering pattern instances from nine open source software systems demonstrate that our approach obtains the balanced high precision and recall.

[1]  Yongtao Sun,et al.  A Matrix-Based Approach to Recovering Design Patterns , 2009, IEEE Transactions on Systems, Man, and Cybernetics - Part A: Systems and Humans.

[2]  Ioannis Stamelos,et al.  Research state of the art on GoF design patterns: A mapping study , 2013, J. Syst. Softw..

[3]  Guohui Li,et al.  A Framework for Automatically Mining Source Code , 2011 .

[4]  Qingshan Jiang,et al.  Detecting Design Pattern Using Subgraph Discovery , 2010, ACIIDS.

[5]  Anil Kumar Tripathi,et al.  A New Approach for Detecting Design Patterns by Graph Decomposition and Graph Isomorphism , 2010, IC3.

[6]  Claudia Raibulet,et al.  Design patterns: a survey on their micro‐structures , 2013, J. Softw. Evol. Process..

[7]  Itay Maman,et al.  Micro patterns in Java code , 2005, OOPSLA '05.

[8]  Michele Risi,et al.  Design pattern recovery through visual language parsing and source code analysis , 2009, J. Syst. Softw..

[9]  Yann-Gaël Guéhéneuc,et al.  DeMIMA: A Multilayered Approach for Design Pattern Identification , 2008, IEEE Transactions on Software Engineering.

[10]  Claudia Raibulet,et al.  Understanding the relevance of micro-structures for design patterns detection , 2011, J. Syst. Softw..

[11]  Yann-Gaël Guéhéneuc,et al.  Efficient identification of design patterns with bit-vector algorithm , 2006, Conference on Software Maintenance and Reengineering (CSMR'06).

[12]  Michele Risi,et al.  Improving Behavioral Design Pattern Detection through Model Checking , 2010, 2010 14th European Conference on Software Maintenance and Reengineering.

[13]  Alexander Chatzigeorgiou,et al.  Design Pattern Detection Using Similarity Scoring , 2006, IEEE Transactions on Software Engineering.

[14]  Joakim Nivre,et al.  Evaluation of Accuracy in Design Pattern Occurrence Detection , 2010, IEEE Transactions on Software Engineering.

[15]  LuciaAndrea De,et al.  Design pattern recovery through visual language parsing and source code analysis , 2009 .

[16]  Ronald A. Olsson,et al.  Reverse Engineering of Design Patterns from Java Source Code , 2006, 21st IEEE/ACM International Conference on Automated Software Engineering (ASE'06).

[17]  Welf Löwe,et al.  Generating design pattern detectors from pattern specifications , 2003, 18th IEEE International Conference on Automated Software Engineering, 2003. Proceedings..

[18]  Jim Welsh,et al.  Towards pattern-based design recovery , 2002, ICSE '02.

[19]  Günter Kniesel,et al.  DPJF - Design Pattern Detection with High Accuracy , 2012, 2012 16th European Conference on Software Maintenance and Reengineering.

[20]  Ghulam Rasool,et al.  Flexible design pattern detection based on feature types , 2011, 2011 26th IEEE/ACM International Conference on Automated Software Engineering (ASE 2011).

[21]  Jing Dong,et al.  Classification of Design Pattern Traits , 2007, SEKE.

[22]  Giuseppe Scanniello,et al.  Clustering and lexical information support for the recovery of design pattern in source code , 2011, 2011 27th IEEE International Conference on Software Maintenance (ICSM).

[23]  Vassilios Tzerpos,et al.  Fine-Grained Design Pattern Detection , 2012, 2012 IEEE 36th Annual Computer Software and Applications Conference.

[24]  Welf Löwe,et al.  Automatic design pattern detection , 2003, 11th IEEE International Workshop on Program Comprehension, 2003..

[25]  Jing Dong,et al.  A Review of Design Pattern Mining Techniques , 2009, Int. J. Softw. Eng. Knowl. Eng..

[26]  Michele Risi,et al.  An Eclipse plug-in for the detection of design pattern instances through static and dynamic analysis , 2010, 2010 IEEE International Conference on Software Maintenance.

[27]  Ghulam Rasool,et al.  Design pattern recovery based on annotations , 2010, Adv. Eng. Softw..

[28]  Dongjin Yu,et al.  From Sub-patterns to Patterns: An Approach to the Detection of Structural Design Pattern Instances by Subgraph Mining and Merging , 2013, 2013 IEEE 37th Annual Computer Software and Applications Conference.

[29]  Dongjin Yu,et al.  Mining Instances of Structural Design Patterns from Class Diagrams Based on Sub-patterns , 2013, ICSR.

[30]  Francesca Arcelli Fontana,et al.  A tool for design pattern detection and software architecture reconstruction , 2011, Inf. Sci..

[31]  Lionel C. Briand,et al.  VPML: an approach to detect design patterns of MOF-based modeling languages , 2015, Software & Systems Modeling.

[32]  Rudolf Ferenc,et al.  Design pattern mining enhanced by machine learning , 2005, 21st IEEE International Conference on Software Maintenance (ICSM'05).

[33]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[34]  Gongjun Yan,et al.  Rule-based detection of design patterns in program code , 2013, International Journal on Software Tools for Technology Transfer.

[35]  Ioannis Stamelos,et al.  Building and mining a repository of design pattern instances: Practical and research benefits , 2013, Entertain. Comput..

[36]  Nadia Bouassida,et al.  A New Approach for Pattern Problem Detection , 2010, CAiSE.