A Feature-Based Method for Detecting Design Patterns in Source Code
Abstract
:1. Introduction
- A new set of features is proposed that is based on the signatures of the design patterns. By using these features, we try to take a step toward solving some of the problems faced by the feature-based detection methods proposed thus far.
- A new design pattern detection method is proposed that builds on concrete definitions of the design pattern variants.
- The proposed method can detect more design pattern variants than other methods with acceptable accuracy.
2. Related Work
2.1. Detection Approaches
2.2. Variant Detection
2.3. Concluding Remarks
3. Ex-DPDFE
3.1. The First Phase: Feature-Based Design Pattern Definition
3.1.1. The First Step: Improving the Signatures of the Design Patterns
3.1.2. The Second Step: Feature Extraction
3.2. The Second Phase: Design Pattern Detection
- Parsing the source code of the input system: To measure behavioral features, the source code of the input system is parsed, and the needed characteristics are stored in a database. Moreover, the different relations between the classes of the input system are extracted and stored in the database. To be time-efficient, source code parsing is performed only once for all the design patterns.
- >Measuring the values of the specified features for the classes of the input system: The feature-based textual definition file resulting from the definition phase is parsed, and the values of the specified features are measured for the classes of the input system. Every class is associated with a flag in the database. This flag refers to the number of features satisfied by its corresponding class for one role. This step is described in detail in Section 4.
- Extracting the classes that satisfy all the features of a specific role: System classes that satisfy all the features that define a role in the design pattern are considered as candidate role classes.
- Finding related role classes: To eliminate possible false positive instances, only the candidate role classes that are related by utilizing the relations specified in the signature of the design pattern are considered as a design pattern instance.
3.3. Implementation Cost
4. Software Implementation
4.1. The Software System of Ex-DPDFE
- Class attributes (visibility, parent classes);
- Method attributes (type, visibility, parameter types, return type);
- Method calls (source and destination);
- The relations between classes (association, dependency, generalization, composition).
Algorithm 1 Extraction of the candidate role classes |
4.2. Computational Complexity
5. Evaluation and Discussion
5.1. Research Questions
5.2. Case Studies
5.3. Method Selection
5.4. Metrics
5.5. Results
5.5.1. RQ1: What Is the Accuracy of Ex-DPDFE in Detecting Design Patterns?
- Using the appropriate features that accurately define design patterns: The used features are extracted from the signatures of design patterns. Therefore, these features represent each design pattern properly.
- Considering both structural and behavioral characteristics of the design patterns in the feature extraction process: The extracted features cover the different aspects of the design patterns (structural and behavioral). Therefore, they enable us to detect the design patterns of all categories (creational, structural, and behavioral).
- Considering the design pattern variants in the process of feature extraction and covering as many variants as possible: By including the characteristics of the design pattern variants within the extracted features, the instances that do not apply to the standard form of a design pattern can be detected.
5.5.2. RQ2: Can Ex-DPDFE Detect More Design Pattern Variants than Some Other Existing Methods?
5.5.3. RQ3: How Do Design Pattern Variants Affect the Accuracy of Detection Methods?
6. Threats to Validity
7. Conclusions and Future Work
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
Appendix A. The Signatures of Some of the GoF Design Patterns
Appendix B. The Proposed Feature-Based Textual Definitions of Some of the GoF Design Patterns
Pattern Name: Singleton | ||
---|---|---|
Role1 name: Singleton | FSR11 | Public static method |
FSR12 | Method returns an object of the same class | |
FSR13 | Non-public constructor |
Pattern Name: Class Adapter | ||
---|---|---|
Role1 name: Adapter | FAR11 | Inheritance |
FAR12 | Implementation | |
FAR13 | Method call to its superclass by a method that overrides another class | |
Role2 name: Adaptee | FAR21 | Called method from its subclass by a method that overrides another class |
Pattern Name: Observer | ||
---|---|---|
Role1 name: Subject | FOR11 | One-to-many association to another class |
FOR12 | Method call to an associated class in loop | |
Role2 name: Observer | FOR21 | One-to-many association from another class |
FOR22 | Called method from an associated class in loop |
Pattern Name: Strategy (State) | ||
---|---|---|
Role1 name: Context | FSR11 | One-to-one association to an interface |
FSR12 | Method call to an associated interface | |
Role2 name: Strategy | FSR21 | Interface |
FSR22 | One-to-one association from another class | |
FSR23 | Called method from an associated class |
Pattern Name: Composite | ||
---|---|---|
Role1 name: Composite | FCR11 | Subclass |
FCR12 | One-to-many association to its superclass | |
FCR13 | Delegation to its superclass with loop by an overriding method | |
Role2 name: Component | FCR21 | Superclass |
FCR22 | One-to-many association from its subclass | |
FCR23 | Delegation from its subclass with loop by an overriding method |
Pattern Name: Abstract Factory (Factory Method) | ||
---|---|---|
Role1 name: Concrete Product | FFR11 | A new instance returned from another class by an overriding method |
Role2 name: Concrete Factory (Concrete Creator) | FFR21 | Subclass |
FFR22 | Not interface | |
FFR23 | Returns a new instance of another class by an overriding method |
Pattern Name: Decorator | ||
---|---|---|
Role1 name: Decorator | FDR11 | Subclass |
FDR12 | One-to-one association to its superclass | |
FDR13 | Method call to its superclass by an overriding method | |
Role2 name: Component | FDR21 | Superclass |
FDR22 | Called method from its subclass | |
FDR23 | One-to-one association from its subclass |
Pattern Name: Template Method | ||
---|---|---|
Role1 name: Abstract Class | FTR11 | Interface |
FTR12 | Method call to an overridden method of the same class |
Pattern Name: Visitor | ||
---|---|---|
Role1 name: Visitor | FVR11 | Superclass |
FVR12 | Called method from another class with an overriding method that has a parameter of the type of the caller | |
FVR13 | One-to-one association from another class | |
FVR14 | Method with a parameter of the type of another class | |
Role2 name: Element | FVR21 | Superclass |
FVR22 | Method with a parameter of the type of another class | |
FVR23 | Method call to another class with a parameter of the type of the caller class | |
Role3 name: Concrete Element | FVR31 | Subclass |
FVR32 | Method with a parameter of the type of another class | |
FVR33 | Method call to another class with a parameter of the type of the caller class |
Appendix C. Some Examples of True Positive and False Positive Instances (If Any) of Some Design Patterns Detected in JHotDraw v5.1
Instance Details | Detected Instance | Instance Type | The Reason of Detection | |
Design Patterns | ||||
---|---|---|---|---|
Singleton | Singleton: CH.ifa.draw.util.Clipboard | TP | Singleton:
| |
Template Method | Abstract Class: CH.ifa.draw.standard.AbstractFigure | TP | Abstract Class:
| |
Observer | Subject: CH.ifa.draw.standard.StandardDrawing, Observer: CH.ifa.draw.framework.DrawingChangeListener | TP | Subject:
| |
Composite | Composite: CH.ifa.draw.standard.CompositeFigure, Component: CH.ifa.draw.framework.Figure | TP | Composite:
| |
Strategy (State) | Context: CH.ifa.draw.applet.DrawApplet Strategy: CH.ifa.draw.framework.Drawing | TP | Strategy:
| |
Context: CH.ifa.draw.standard.DragTracker Strategy: CH.ifa.draw.framework.Figure | FP | These classes satisfy the features used to identify the Strategy design pattern without meeting the goal of the pattern. | ||
Decorator | Decorator: CH.ifa.draw.standard.DecoratorFigure, Component: CH.ifa.draw.framework.Figure | TP | Decorator:
| |
Factory Method (Abstract Factory) | Concrete Product: CH.ifa.draw.framework.Connector, Concrete Creator: CH.ifa.draw.standard.AbstractFigure | TP | Concrete Creator:
| |
Concrete Product: CH.ifa.draw.framework.Locator Concrete Creator: CH.ifa.draw.contrib.PolygonFigure | FP | These classes satisfy the features used to identify the Factory Method design pattern without meeting the goal of the pattern. |
References
- Gamma, E.; Helm, R.; Johnson, R.E.; Vlissides, J. Design Patterns: Elements of Reusable Object-Oriented Software; Addison-Wesley: Boston, MA, USA, 1995. [Google Scholar]
- Xiong, R.; Li, B. Accurate design pattern detection based on idiomatic implementation matching in Java language context. In Proceedings of the IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER), Hangzhou, China, 24–27 February 2019. [Google Scholar]
- Ampatzoglouaba, A. A methodology to assess the impact of design patterns on software quality. Inf. Softw. Technol. 2012, 54, 331–346. [Google Scholar] [CrossRef]
- Shilintsev, D.; Dlamini, G. A study: Design patterns detection approaches and impact on software quality. In Proceedings of the International Conference on Frontiers in Software Engineering, Innopolis, Russia, 17–18 June 2021. [Google Scholar]
- Jaafar, F.; Guéhéneuc, Y.-G.; Hamel, S.; Khomh, F.; Zulkernine, M. Evaluating the impact of design pattern and anti-pattern dependencies on changes and faults. Empir. Softw. Eng. 2016, 21, 896–931. [Google Scholar] [CrossRef]
- Hussain, S.; Keung, J.; Khan, A.A. Software design patterns classification and selection. Appl. Soft. Comput. 2017, 58, 225–244. [Google Scholar] [CrossRef]
- Lucia, A.D.; Deufemia, V.; Gravino, C.; Risi, M. Detecting the behavior of design patterns through model checking and dynamic analysis. ACM Trans. Softw. Eng. Methodol. 2018, 26, 1–41. [Google Scholar] [CrossRef]
- Niere, J.; Schafer, W.; Wadsack, J.P.; Wendehals, L.; Welsh, J. Towards pattern-based design recovery. In Proceedings of the 24th International Conference on Software Engineering, Orlando, FL, USA, 19–25 May 2002. [Google Scholar]
- Mayvan, B.B.; Rasoolzadegan, A. Design pattern detection based on the graph theory. Knowl.-Based Syst. 2017, 120, 211–225. [Google Scholar] [CrossRef]
- Al-Obeidallah, M.G.; Petridis, M.; Kapetanakis, S. A survey on design pattern detection approaches. Int. J. Softw. Eng. 2016, 7, 41–59. [Google Scholar]
- Rasool, G.; Streitfdert, D. A survey on design pattern recovery techniques. Int. J. Comput. Sci. Issues 2011, 8, 251–260. [Google Scholar]
- Shahbazi, Z.; Rasoolzadegan, A.; Purfallah, Z.; Horestani, S.J. A new method for detecting various variants of GoF design patterns using conceptual signatures. Softw. Qual. J. 2021. [Google Scholar] [CrossRef]
- Tsantalis, N.; Chatzigeorgiou, A.; Stephanides, G.; Halkidis, S.T. Design pattern detection using similarity scoring. IEEE Trans. Softw. Eng. 2006, 32, 896–909. [Google Scholar] [CrossRef]
- Sahoo, S.K. Social object—A software design pattern. In Proceedings of the IEEE 2nd International Conference on Software Engineering and Service Science, Beijing, China, 15–17 July 2011. [Google Scholar]
- Bayley, I.; Zhu, H. Formal specification of the variants and behavioral features of design patterns. J. Syst. Softw. 2010, 83, 209–221. [Google Scholar] [CrossRef] [Green Version]
- Gao, C. Application of design patterns to control system of digital photofinishing. In Proceedings of the Third International Symposium on Intelligent Information Technology Application, Nanchang, China, 21–22 November 2009. [Google Scholar]
- Stencel, K.; Węgrzynowicz, P. Detection of diverse design pattern variants. In Proceedings of the 15th Asia-Pacific Software Engineering Conference, Beijing, China, 3–5 December 2008. [Google Scholar]
- Rasool, G.; Akhtar, H. Towards a catalog of design patterns variants. In Proceedings of the International Conference on Frontiers of Information Technology (FIT), Islamabad, Pakistan, 16–18 December 2019. [Google Scholar]
- Yarahmadi, H.; Hasheminejad, S.M.H. Design pattern detection approaches: A systematic review of the literature. Artif. Intell. Rev. 2020, 53, 5789–5846. [Google Scholar] [CrossRef]
- Dwivedi, A.K.; Tirkey, A.; Rath, S.K. Applying learning-based methods for recognizing design patterns. Innov. Syst. Softw. Eng. 2019, 15, 87–100. [Google Scholar] [CrossRef]
- Zein, S.; Rimawi, D. A static analysis of android source code for design patterns usage. Int. J. Adv. Trends Comput. Sci. Eng. 2020, 9, 2178–2186. [Google Scholar]
- Liu, W.; Zhang, C.; Wang, F.; Yang, Y. Combining network analysis with structural matching for design pattern detection. In Proceedings of the Evaluation and Assessment in Software Engineering (EASE ‘20), Trondheim, Norway, 15–17 April 2020. [Google Scholar]
- Guimaraes, E.; Cai, Y. Understanding software systems through interactive pattern detection. In Proceedings of the IEEE International Conference on Software Architecture Companion (ICSA-C), Salvador, Brazil, 2–6 November 2020. [Google Scholar]
- Xiong, R.; Lo, D.; Li, B. Distinguishing similar design pattern instances through temporal behavior analysis. In Proceedings of the IEEE 27th International Conference on Software Analysis, Evolution and Reengineering (SANER), London, ON, Canada, 18–21 February 2020. [Google Scholar]
- Oruc, M.; Akal, F.; Sever, H. Detecting design patterns in object-oriented design models by using a graph mining approach. In Proceedings of the 4th International Conference in Software Engineering Research and Innovation (CONISOFT), Puebla, Mexico, 27–29 April 2016. [Google Scholar]
- Dong, J.; Sun, Y.; Zhao, Y. Design pattern detection by template matching. In Proceedings of the ACM Symposium on Applied Computing, Fortaleza, Ceara, Brazil, 16–20 March 2008. [Google Scholar]
- Yu, D.; Ge, J.; Wu, W. Detection of design pattern instances based on graph isomorphism. In Proceedings of the IEEE 4th International Conference on Software Engineering and Service Science, Beijing, China, 23–25 May 2013. [Google Scholar]
- Singh, J.; Gupta, M. Design pattern detection using Dpdetect algorithm. Int. J. Innov. Technol. Explor. Eng. 2019, 8, 2278–3075. [Google Scholar]
- Pande, A.; Pant, V.; Gupta, M.; Mishra, A. Design patterns discovery in source code: Novel technique using substring match. TEM J. 2021, 10, 1166–1174. [Google Scholar] [CrossRef]
- Huang, H.Y.; Zhang, S.S.; Cao, J.; Duan, Y.H. A practical pattern recovery approach based on both structural and behavioral analysis. J. Syst. Softw. 2005, 75, 69–87. [Google Scholar] [CrossRef]
- Yu, D.; Zhang, Y.; Chen, Z. A comprehensive approach to the recovery of design pattern instances based on sub-patterns and method signatures. J. Syst. Softw. 2015, 103, 1–16. [Google Scholar] [CrossRef]
- Bernardi, M.L.; Cimitile, M.; Lucca, G.D. Design pattern detection using a DSL-driven graph matching approach. J. Softw.-Evol. Process 2014, 26, 1233–1266. [Google Scholar] [CrossRef]
- Singh, J.; Chowdhuri, S.R.; Bethany, G.; Gupta, M. Detecting design patterns: A hybrid approach based on graph matching and static analysis. Inf. Technol. Manag. 2021. [Google Scholar] [CrossRef]
- Liu, C. A general framework to detect design patterns by combining static and dynamic analysis techniques. Int. J. Softw. Eng. Knowl. Eng. 2021, 31, 21–54. [Google Scholar] [CrossRef]
- Rasool, G.; Mäder, P. A customizable approach to design pattern recognition based on feature types. Arab. J. Sci. Eng. 2014, 39, 8851–8873. [Google Scholar] [CrossRef]
- Mohamed, K.A.; Kamel, A. Reverse engineering state and strategy design patterns using static code analysis. Int. J. Adv. Comput. Sci. Appl. 2018, 9, 568–576. [Google Scholar]
- Martino, B.D.; Esposito, A. A rule-based procedure for automatic recognition of design patterns in UML diagrams. Softw.-Pract. Exp. 2016, 46, 983–1007. [Google Scholar] [CrossRef]
- Alnusair, A.; Zhao, T.; Yan, G. Rule-based detection of design patterns in program code. Int. J. Softw. Tools Technol. Transf. 2014, 16, 315–334. [Google Scholar] [CrossRef]
- Thongrak, M.; Vatanawood, W. Detection of design pattern in class diagram using ontology. In Proceedings of the International Computer Science and Engineering Conference (ICSEC), Khon Kaen, Thailand, 30 July–1 August 2014. [Google Scholar]
- Ren, W.; Zhao, W. An observer design-pattern detection technique. In Proceedings of the IEEE International Conference on Computer Science and Automation Engineering (CSAE), Zhangjiajie, China, 25–27 May 2012. [Google Scholar]
- Vokác, M. An efficient tool for recovering Design Patterns from C++ Code. J. Object Technol. 2006, 5, 139–157. [Google Scholar] [CrossRef] [Green Version]
- Lucia, A.D.; Deufemia, V.; Gravino, C.; Risi, M. Design pattern recovery through visual language parsing and source code analysis. J. Syst. Softw. 2009, 82, 1177–1193. [Google Scholar] [CrossRef]
- Lucia, A.D.; Deufemia, V.; Gravino, C.; Risi, M. 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, Timisoara, Romania, 12–18 September 2010. [Google Scholar]
- Costagliola, G.; Lucia, A.D.; Deufemia, V.; Gravino, C.; Risi, M. Design pattern recovery by visual language parsing. In Proceedings of the Ninth European Conference on Software Maintenance and Reengineering, Manchester, UK, 23 March 2005. [Google Scholar]
- Lucia, A.D.; Deufemia, V.; Gravino, C.; Risi, M. Behavioral pattern identification through visual language parsing and code instrumentation. In Proceedings of the 13th European Conference on Software Maintenance and Reengineering, Kaiserslautern, Germany, 24–27 March 2009. [Google Scholar]
- Hayashi, S.; Katada, J.; Sakamoto, R.; Kobayashi, T.; Saeki, M. Design pattern detection by using meta patterns. IEICE Transactions on Information and Systems 2008, E91.D, 933–944. [Google Scholar] [CrossRef]
- Wuyts, R. Declarative reasoning about the structure of object-oriented systems. In Proceedings of the Technology of Object-Oriented Languages, Santa Barbara, CA, USA, 3–7 August 1998. [Google Scholar]
- Kramer, C.; Prechelt, L. Design recovery by automated search for structural design patterns in object-oriented software. In Proceedings of the 4th Working Conference on Reverse Engineering (WCRE ’96), Monterey, CA, USA, 8–10 November 1996. [Google Scholar]
- Albin-Amiot, H.; Cointe, P.; Guéhéneuc, Y.-G.; Jussien, N. Instantiating and detecting design patterns: Putting bits and pieces together. In Proceedings of the 16th Annual International Conference on Automated Software Engineering, San Diego, CA, USA, 26–29 November 2001. [Google Scholar]
- Guéhéneuc, Y.-G.; Antoniol, G. DeMIMA: A multilayered approach for design pattern identification. IEEE Trans. Softw. Eng. 2008, 34, 667–684. [Google Scholar] [CrossRef]
- Guéhéneuc, Y.-G.; Albin-Amiot, H. Using design patterns and constraints to automate the detection and correction of inter-class design defects. In Proceedings of the 39th International Conference and Exhibition on Technology of Object-Oriented Languages and Systems (TOOLS 39), Santa Barbara, CA, USA, 29 July–3 August 2001. [Google Scholar]
- Zhu, H.; Bayley, I.; Shan, L.; Amphlett, R. Tool support for design pattern recognition at model level. In Proceedings of the 33rd Annual IEEE International Computer Software and Applications Conference, Seattle, WA, USA, 20–24 July 2009. [Google Scholar]
- Wierda, A.; Dortmans, E.; Somers, L. Pattern detection in object-oriented source code. In Proceedings of the International Conference on Software and Data Technologies, Barcelona, Spain, 22–25 July 2007. [Google Scholar]
- Mens, K.; Tourwé, T. Delving source code with formal concept analysis. Comput. Lang. Syst. Struct. 2005, 31, 183–197. [Google Scholar] [CrossRef]
- Blewitt, A.; Bundy, A.; Stark, I. Automatic verification of design patterns in Java. In Proceedings of the 20th IEEE/ACM International Conference on Automated software engineering, New York, NY, USA, 7–11 November 2005. [Google Scholar]
- Issaoui, I.; Bouassida, N.; Ben-Abdallah, H. Using metric-based filtering to improve design pattern detection approaches. Innov. Syst. Softw. Eng. 2014, 11, 39–53. [Google Scholar] [CrossRef]
- Guéhéneuc, Y.-G.; Guyomarc’h, J.-Y.; Sahraoui, H. Improving design-pattern identification: A new approach and an exploratory study. Softw. Qual. J. 2010, 18, 145–174. [Google Scholar] [CrossRef]
- Kim, H.; Boldyreff, C. A method to recover design patterns using software product metrics. In Proceedings of the International Conference on Software Reuse (ICSR), Vienna, Austria, 27–29 June 2000. [Google Scholar]
- Antoniol, G.; Fiutem, R.; Cristoforetti, L. Using metrics to identify design patterns in object-oriented software. In Proceedings of the Fifth International Software Metrics Symposium Metrics, Bethesda, MD, USA, 20–21 March 1998. [Google Scholar]
- Antoniol, G.; Casazza, G.; Penta, M.D.; Fiutem, R. Object oriented design patterns recovery. J. Syst. Softw. 2001, 59, 181–196. [Google Scholar] [CrossRef]
- Guéhéneuc, Y.-G.; Sahraoui, H.; Zaidi, F. Fingerprinting design patterns. In Proceedings of the 11th Working Conference on Reverse Engineering, Delft, The Netherlands, 8–12 November 2004. [Google Scholar]
- Nazar, N.; Aleti, A.; Zheng, Y. Feature-based software design pattern detection. J. Syst. Softw. 2021, 185, 111179. [Google Scholar] [CrossRef]
- Huang, X.-L.; Ma, X.; Hu, F. Editorial: Machine Learning and Intelligent Communications. Mob. Netw. Appl. 2018, 23, 68–70. [Google Scholar] [CrossRef] [Green Version]
- Dwivedi, A.K.; Tirkey, A.; Rath, S.K. Software design pattern mining using classification-based techniques. Front. Comput. Sci. 2018, 12, 908–922. [Google Scholar] [CrossRef]
- Detten, M.V.; Becker, S. 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, New York, NY, USA, 20–24 June 2011. [Google Scholar]
- Uchiyama, S.; Washizaki, H.; Fukazawa, Y.; Kubo, A. Design pattern detection using software metrics and machine learning. In Proceedings of the Fifth International Workshop on Software Quality and Maintainability (SQM2011), Oldenburg, Germany, 1–4 March 2011. [Google Scholar]
- Uchiyama, S.; Kubo, A.; Washizaki, H.; Fukazawa, Y. Detecting design patterns in object-oriented program source code by using metrics and machine learning. J. Softw. Eng. Appl. 2014, 7, 983–998. [Google Scholar] [CrossRef] [Green Version]
- Gupta, M.; Singh, S. Comparative analysis of software design patterns-based design metrics using machine learning algorithms. Int. J. Comput. Eng. Technol. 2018, 9, 32–41. [Google Scholar]
- Dwivedi, A.K.; Tirkey, A.; Rath, S.K. Applying software metrics for the mining of design pattern. In Proceedings of the IEEE Uttar Pradesh Section International Conference on Electrical, Computer and Electronics Engineering (UPCON), Varanasi, India, 9–11 December 2016. [Google Scholar]
- Dwivedi, A.K.; Rath, S.K.; Satapathy, S.M. Neural network-based patterns detection in object-oriented program. In Proceedings of the 9th Annual Information Technology, Electromechanical Engineering and Microelectronics Conference (IEMECON), Jaipur, India, 13–15 March 2019. [Google Scholar]
- Dwivedi, A.K.; Rath, S.K.; Satapathy, S.M. Applying neural network to determine patterns in open-source software. In Proceedings of the IEEE 5th International Conference for Convergence in Technology (I2CT), Bombay, India, 29–31 March 2019. [Google Scholar]
- Paakki, J.; Karhinen, A.; Gustafsson, J.; Nenonen, L.; Verkamo, A.I. Software metrics by architectural pattern mining. In Proceedings of the International Conference on Software: Theory and Practice (16th IFIP World Computer Congress), Beijing, China, 21–24 August 2000. [Google Scholar]
- Chihada, A.; Jalili, S.; Hasheminejad, S.M.H.; Zangooei, M.H. Source code and design conformance, design pattern detection from source code by classification approach. Appl. Soft Comput. 2015, 26, 357–367. [Google Scholar] [CrossRef]
- Chaturvedi, A.; Gupta, M.; Gupta, S.K. Design pattern detection using genetic algorithm for sub-graph isomorphism to enhance software reusability. Int. J. Comput. Appl. 2016, 135, 33–36. [Google Scholar] [CrossRef]
- Chaturvedi, S.; Chaturvedi, A.; Tiwari, A.; Agarwal, S. Design pattern detection using machine learning techniques. In Proceedings of the 7th International Conference on Reliability, Infocom Technologies and Optimization (Trends and Future Directions) (ICRITO), Noida, India, 29–31 August 2018. [Google Scholar]
- Gupta, M. Design pattern mining using greedy algorithm for multi-labelled graphs. Int. J. Inf. Commun. Technol. 2011, 3, 314–323. [Google Scholar] [CrossRef]
- Fontana, F.A.; Zanoni, M. A tool for design pattern detection and software architecture reconstruction. Inf. Sci. 2011, 181, 1306–1324. [Google Scholar] [CrossRef]
- Arcelli, F.; Christina, L. Enhancing Software Evolution through Design Pattern Detection. In Proceedings of the Third International IEEE Workshop on Software Evolvability, Paris, France, 1 October 2007. [Google Scholar]
- Tonella, P.; Antoniol, G. Object oriented design pattern inference. In Proceedings of the IEEE International Conference on Software Maintenance, Oxford, UK, 30 August–3 September 1999. [Google Scholar]
- Lebon, M.; Tzerpos, V. Fine-grained design pattern detection. In Proceedings of the IEEE 36th Annual Computer Software and Applications Conference, Izmir, Turkey, 16–20 July 2012. [Google Scholar]
- Dietrich, J.; Elgar, C. A formal description of design patterns using OWL. In Proceedings of the Australian Software Engineering Conference, Brisbane, QLD, Australia, 29 March–1 April 2005. [Google Scholar]
- Elaasar, M.; Briand, L.C.; Labiche, Y. A metamodeling approach to pattern specification. In Proceedings of the 9th International Conference on Model Driven Engineering Languages and Systems (MODELS 2006), Genoa, Italy, 1–6 October 2006. [Google Scholar]
- Dietrich, J.; Elgar, C. An ontology-based representation of software design patterns. In Design Pattern Formalization Techniques; IGI Global: Hershey, PA, USA, 2007; pp. 258–279. [Google Scholar]
- Blewitt, A. Spine: Language for pattern verification. In Design Pattern Formalization Techniques; IGI Global: Hershey, PA, USA, 2007; pp. 109–122. [Google Scholar]
- Chidamber, S.R.; Kemerer, C.F. A metrics suite for object-oriented design. IEEE Trans. Softw. Eng. 1994, 20, 476–493. [Google Scholar] [CrossRef] [Green Version]
- Hernandez, J.; Kubo, A.; Washizaki, H.; Yoshiaki, F. Selection of metrics for predicting the appropriate application of design patterns. In Proceedings of the 2nd Asian Conference on Pattern Languages of Programs, Tokyo, Japan, 5–8 October 2011. [Google Scholar]
- Derezińska, A. Metrics in software development and evolution with design patterns. In Proceedings of the Computer Science On-line Conference (CSOC2018), Vsetin, Czech Republic, 25–28 April 2018. [Google Scholar]
- Mayvan, B.B.; Rasoolzadegan, A.; Ebrahimi, A.M. A new benchmark for evaluating pattern mining methods based on the automatic generation of testbeds. Inf. Softw. Technol. 2019, 109, 60–79. [Google Scholar] [CrossRef]
- Vokac, M. Defect frequency and design patterns: An empirical study of industrial code. IEEE Trans. Softw. Eng. 2004, 30, 904–917. [Google Scholar] [CrossRef]
- Pettersson, N.; Löwe, W.; Nivre, J. Evaluation of accuracy in design pattern occurrence detection. IEEE Trans. Softw. Eng. 2010, 26, 575–590. [Google Scholar] [CrossRef]
Characteristics | Explanation | Used Values | Type | |
---|---|---|---|---|
Feature Name | ||||
Class abstraction level | Refers to the type of a class (interface, abstract, or concrete class) |
| Structural | |
Constructor visibility | Refers to the accessibility of the constructor of a class (private, protected, or public) |
| ||
Method visibility | Refers to the accessibility of a method (private, protected, or public) |
| ||
Method modifier | Refers to the modifiers of a method (static, final, synchronized, or abstract) |
| ||
Inheritance | Refers to a class that exists within an inheritance hierarchy |
| ||
Association | Refers to a class that has a reference to another class |
| ||
Overriding | Refers to a method that overrides (implements) a method of its superclass |
| ||
Method return type | Refers to a method that returns an instance of the same or another class |
| Behavioral | |
Method call | Refers to a method that calls a method of the same or another class |
| ||
Dependency | Refers to a class that has a method with a parameter of the type of another class |
| ||
Delegation | Refers to a method that delegates to another method |
| ||
Composition | Refers to an object that only exists within another object |
|
Design Pattern | Abstract Factory/Factory Method | Singleton | Decorator | Strategy/State | Template Method | Visitor | Adapter | Composite | Observer | Command | Proxy | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Feature Name | ||||||||||||
Class abstraction level | ✓ | × | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | × | ✓ | ✓ | |
Constructor visibility | × | ✓ | × | × | × | × | × | × | × | × | × | |
Method modifier | × | ✓ | × | × | × | × | × | × | × | × | × | |
Method return type | ✓ | ✓ | × | × | × | × | × | × | × | × | × | |
Method call | × | × | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Inheritance | × | × | × | ✓ | × | ✓ | × | × | × | × | × | |
Dependency | × | × | × | × | × | ✓ | × | × | × | × | × | |
Association | × | × | ✓ | ✓ | × | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Overriding | ✓ | × | ✓ | × | × | × | ✓ | ✓ | × | ✓ | × | |
Delegation | × | × | × | × | × | × | × | ✓ | × | × | × | |
Composition | × | × | × | × | × | × | × | × | × | ✓ | × |
Characteristics | Number of Classes | Number of Methods | KLOC | |
---|---|---|---|---|
Systems | ||||
JRefactory v2.6.24 | 566 | 4609 | 93.1 | |
JHotDraw v5.1 | 155 | 1334 | 13.5 | |
JUnit v3.7 | 93 | 681 | 6.4 | |
QuickUML 2001 | 217 | 1094 | 18.4 |
Characteristics | Number of Classes per Project | Average KLOC | |
---|---|---|---|
Testbeds | |||
Testbed1–Testbed10 | 200 | 9.87 | |
Testbed11–Testbed20 | 300 | 14.89 | |
Testbed21–Testbed30 | 400 | 19.65 |
Characteristics | Number of Classes | Number of Methods | KLOC | |
---|---|---|---|---|
Systems | ||||
JHotDraw v5.2 | 168 | 1460 | 14.7 | |
JHotDraw v5.3 | 242 | 2316 | 24.8 | |
JUnit v2 | 39 | 315 | 2.7 | |
JUnit v3 | 116 | 841 | 7.2 | |
JUnit v3.8.1 | 56 | 514 | 4.8 |
Open-Source Projects | JRefactory v2.6.24 | JHotDraw v5.1 | JUnit v3.7 | QuickUML 2001 | |
---|---|---|---|---|---|
Design Patterns | |||||
Singleton | 10 | 1 | 0 | 1 | |
Adapter | 40 | 26 | 7 | 10 | |
Abstract Factory/Factory Method | 11 | 17 | 0 | 5 | |
Template Method | 18 | 8 | 3 | 5 | |
Composite | 0 | 1 | 1 | 1 | |
Observer | 6 | 5 | 3 | 8 | |
State/Strategy | 29 | 42 | 3 | 5 | |
Decorator | 0 | 4 | 1 | 1 | |
Visitor | 2 | 0 | 0 | 0 | |
Prototype | 0 | 2 | 0 | 1 | |
Builder | 0 | 0 | 0 | 0 | |
Bridge | 0 | 0 | 0 | 0 | |
Facade | 0 | 0 | 0 | 0 | |
Flyweight | 0 | 0 | 0 | 0 | |
Proxy | 11 | 1 | 0 | 6 | |
Chain of Responsibility | 0 | 0 | 0 | 0 | |
Command | 7 | 14 | 0 | 0 | |
Mediator | 0 | 0 | 0 | 0 | |
Iterator | 0 | 0 | 0 | 0 | |
Memento | 0 | 0 | 0 | 0 | |
Interpreter | 0 | 0 | 0 | 0 |
Detection Methods | DeMIMA | SSA | SparT | GTM | CA | Ex-DPDFE | P-MART | |
---|---|---|---|---|---|---|---|---|
Design Patterns | ||||||||
Singleton | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Adapter | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Abstract Factory | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Factory Method | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Template Method | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Composite | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Observer | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
State | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Strategy | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Decorator | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Visitor | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Prototype | ✓ | ✓ | ✓ | × | ✓ | ✓ | ✓ | |
Builder | × | × | ✓ | × | ✓ | ✓ | ✓ | |
Bridge | × | × | ✓ | × | ✓ | ✓ | ✓ | |
Facade | × | × | ✓ | × | ✓ | ✓ | ✓ | |
Flyweight | × | × | ✓ | × | ✓ | ✓ | ✓ | |
Proxy | × | × | ✓ | × | ✓ | ✓ | ✓ | |
Chain of Responsibility | × | × | ✓ | × | ✓ | ✓ | ✓ | |
Command | ✓ | ✓ | ✓ | × | ✓ | ✓ | ✓ | |
Mediator | × | × | ✓ | × | ✓ | ✓ | ✓ | |
Iterator | × | × | ✓ | × | ✓ | ✓ | ✓ | |
Memento | × | × | ✓ | × | ✓ | ✓ | ✓ | |
Interpreter | × | × | ✓ | × | ✓ | ✓ | ✓ |
Detection Results | JHotDraw v5.1 | JUnit v3.7 | QuickUML 2001 | JRefactory v2.6.24 | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Design Patterns | TP | FP | P% | F% | TP | FP | P% | F% | TP | FP | P% | F% | TP | FP | P% | F% | |
Singleton | 1 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 1 | 0 | 100 | 100 | 10 | 0 | 100 | 100 | |
Adapter | 26 | 1 | 96.3 | 98 | 7 | 1 | 87.5 | 93 | 10 | 1 | 90.9 | 95 | 40 | 4 | 90.9 | 95 | |
Abstract Factory/Factory Method | 17 | 2 | 89.5 | 94 | 0 | 0 | 100 | 100 | 5 | 0 | 100 | 100 | 11 | 1 | 91.7 | 96 | |
Template Method | 8 | 0 | 100 | 100 | 3 | 0 | 100 | 100 | 5 | 0 | 100 | 100 | 18 | 2 | 90 | 95 | |
Composite | 1 | 0 | 100 | 100 | 1 | 0 | 100 | 100 | 1 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | |
Observer | 5 | 1 | 83.3 | 91 | 3 | 1 | 75 | 86 | 8 | 2 | 80 | 89 | 6 | 1 | 85.7 | 92 | |
State/Strategy | 42 | 2 | 95.5 | 98 | 3 | 0 | 100 | 100 | 5 | 2 | 71.4 | 83 | 29 | 4 | 87.9 | 94 | |
Decorator | 4 | 0 | 100 | 100 | 1 | 0 | 100 | 100 | 1 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | |
Visitor | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 2 | 0 | 100 | 100 | |
Prototype | 2 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 1 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | |
Builder | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | |
Bridge | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | |
Facade | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | |
Flyweight | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | |
Proxy | 1 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 6 | 0 | 100 | 100 | 11 | 0 | 100 | 100 | |
Chain of Responsibility | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | |
Command | 14 | 2 | 87.5 | 93 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 7 | 3 | 70 | 82.4 | |
Mediator | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | |
Iterator | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | |
Memento | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | |
Interpreter | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 | 0 | 0 | 100 | 100 |
Detection Results | DeMIMA | SSA | SparT | GTM | CA | Ex-DPDFE | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Design Patterns | P% | R% | F% | P% | R% | F% | P% | R% | F% | P% | R% | F% | P% | R% | F% | P% | R% | F% | |
Singleton | 78.6 | 100 | 88 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | |
Adapter | 9.95 | 100 | 18.1 | 100 | 100 | 100 | 85.8 | 83.2 | 84.5 | 100 | 100 | 100 | 100 | 100 | 100 | 91.4 | 100 | 95.5 | |
Abstract Factory/Factory Method | 26.35/0.75 | 100/100 | 41.7/1.5 | 100 | 63.9 | 78 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 95.3 | 100 | 97.6 | |
Template Method | 1.6 | 100 | 3.1 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 97.5 | 100 | 98.7 | |
Composite | 67.7 | 100 | 80.7 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | |
Observer | 25 | 100 | 40 | 100 | 100 | 100 | 93.8 | 100 | 96.8 | 100 | 100 | 100 | 100 | 50 | 66.7 | 81 | 100 | 89.5 | |
State/Strategy | 9.4 | 100 | 17.2 | 100 | 95.7 | 97.8 | 63.3 | 94.2 | 75.7 | 100 | 100 | 100 | 100 | 100 | 100 | 88.7 | 100 | 94 | |
Decorator | 51.9 | 100 | 68.3 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | |
Visitor | 87.5 | 100 | 93.3 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | 100 | |
Prototype | 75 | 100 | 85.7 | 100 | 100 | 100 | 100 | 100 | 100 | - | - | - | 100 | 100 | 100 | 100 | 100 | 100 | |
Builder | - | - | - | - | - | - | 100 | 100 | 100 | - | - | - | 100 | 100 | 100 | 100 | 100 | 100 | |
Bridge | - | - | - | - | - | - | 100 | 100 | 100 | - | - | - | 100 | 100 | 100 | 100 | 100 | 100 | |
Facade | - | - | - | - | - | - | 100 | 100 | 100 | - | - | - | 100 | 100 | 100 | 100 | 100 | 100 | |
Flyweight | - | - | - | - | - | - | 100 | 100 | 100 | - | - | - | 100 | 100 | 100 | 100 | 100 | 100 | |
Proxy | - | - | - | - | - | - | 95.8 | 97.7 | 96.7 | - | - | - | 100 | 100 | 100 | 100 | 100 | 100 | |
Chain of Responsibility | - | - | - | - | - | - | 100 | 100 | 100 | - | - | - | 100 | 100 | 100 | 100 | 100 | 100 | |
Command | 8.53 | 100 | 15.7 | 100 | 100 | 100 | 100 | 100 | 100 | - | - | - | 100 | 100 | 100 | 89.4 | 100 | 94.4 | |
Mediator | - | - | - | - | - | - | 100 | 100 | 100 | - | - | - | 100 | 100 | 100 | 100 | 100 | 100 | |
Iterator | - | - | - | - | - | - | 100 | 100 | 100 | - | - | - | 100 | 100 | 100 | 100 | 100 | 100 | |
Memento | - | - | - | - | - | - | 100 | 100 | 100 | - | - | - | 100 | 100 | 100 | 100 | 100 | 100 | |
Interpreter | - | - | - | - | - | - | 100 | 100 | 100 | - | - | - | 100 | 100 | 100 | 100 | 100 | 100 |
Detection Results | T | TP | FP | P% | R% | F% | |
---|---|---|---|---|---|---|---|
Design Patterns | |||||||
Singleton | 87 | 87 | 0 | 100 | 100 | 100 | |
Class Adapter | 34 | 34 | 0 | 100 | 100 | 100 | |
Object Adapter | 42 | 42 | 0 | 100 | 100 | 100 | |
Abstract Factory/Factory Method | Variant F1 | 34 | 34 | 0 | 100 | 100 | 100 |
Variant F2 | 121 | 121 | 0 | 100 | 100 | 100 | |
Template Method | 48 | 48 | 0 | 100 | 100 | 100 | |
Composite | Variant C1 | 39 | 39 | 0 | 100 | 100 | 100 |
Variant C2 | 42 | 42 | 0 | 100 | 100 | 100 | |
Variant C3 | 33 | 33 | 0 | 100 | 100 | 100 | |
Observer | Variant O1 | 41 | 41 | 0 | 100 | 100 | 100 |
Variant O2 | 38 | 38 | 0 | 100 | 100 | 100 | |
State/Strategy | 157 | 157 | 0 | 100 | 100 | 100 | |
Decorator | 40 | 40 | 0 | 100 | 100 | 100 | |
Visitor | 34 | 34 | 0 | 100 | 100 | 100 |
Detection Results | DeMIMA | SSA | SparT | CA | Ex-DPDFE | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Design Patterns | P% | R% | F% | P% | R% | F% | P% | R% | F% | P% | R% | F% | P% | R% | F% | |
Singleton | 100 | 53.8 | 70 | 100 | 100 | 100 | 100 | 100 | 100 | 56.7 | 78.3 | 65.8 | 100 | 100 | 100 | |
Adapter | 0 | 0 | na | 100 * | 100 * | 100 | 100 * | 100 * | 100 | 100 | 94.3 | 97 | 100 | 100 | 100 | |
Abstract Factory/Factory Method | 9.9 | 24.4 | 14 | 100 | 21.9 | 36 | 0 | 0 | na | 89 | 19.8 | 32.4 | 100 | 100 | 100 | |
Template Method | 0 | 0 | na | 0 | 0 | na | 0 | 0 | na | 0 | 0 | na | 100 | 100 | 100 | |
Composite | 0 | 0 | na | 100 | 34.2 | 51 | 100 | 71.1 | 83.1 | 72.3 | 24.3 | 36.4 | 100 | 100 | 100 | |
Observer | 0 | 0 | na | 100 | 48.1 | 65 | 100 | 48.1 | 65 | 21 | 30.2 | 24.8 | 100 | 100 | 100 | |
State/Strategy | 91.1 | 100 | 95.3 | 100 | 100 | 100 | 100 | 100 | 100 | 50.3 | 100 | 66.9 | 100 | 100 | 100 | |
Decorator | 0 | 0 | na | 100 | 100 | 100 | 100 | 100 | 100 | 27.7 | 22 | 24.5 | 100 | 100 | 100 | |
Visitor | 0 | 0 | na | 0 | 0 | na | 0 | 0 | na | 0 | 0 | na | 100 | 100 | 100 |
Cost | Average Human Hours | ||
---|---|---|---|
Step | |||
The definition phase | Signatures’ improvement | 2 h per pattern | |
Feature extraction | 2 h per pattern | ||
The detection phase | Source code parsing | 120 h | |
Features’ measurement | 4 h per feature | ||
Candidate Role classes’ extraction | 1 h | ||
Finding related role classes | 1 h |
Cost | Feature Type | KLOC | Time (s) | |
---|---|---|---|---|
Step | ||||
Source code parsing | - | 2.7 | 90 | |
4.8 | 135 | |||
6.4 | 210 | |||
7.2 | 300 | |||
9.87 | 390 | |||
13.5 | 540 | |||
14.7 | 600 | |||
14.89 | 615 | |||
18.4 | 750 | |||
19.65 | 870 | |||
24.8 | 1130 | |||
93.1 | 2245 | |||
Features’ measurement(features’ average) | Structural | No major effect | 0.03 | |
Behavioral | 2.7 | 0.05 | ||
4.8 | 0.09 | |||
6.4 | 0.11 | |||
7.2 | 0.14 | |||
9.87 | 0.17 | |||
13.5 | 0.21 | |||
14.7 | 0.23 | |||
14.89 | 0.24 | |||
18.4 | 0.29 | |||
19.65 | 0.32 | |||
24.8 | 0.37 | |||
93.1 | 0.63 | |||
Candidate Role classes’ extraction | No major effect | No major effect | 0.01 | |
Finding related role classes(patterns’ average) | No major effect | 2.7 | 0.02 | |
4.8 | 0.023 | |||
6.4 | 0.027 | |||
7.2 | 0.028 | |||
9.87 | 0.031 | |||
13.5 | 0.037 | |||
14.7 | 0.039 | |||
14.89 | 0.04 | |||
18.4 | 0.061 | |||
19.65 | 0.063 | |||
24.8 | 0.08 | |||
93.1 | 0.14 |
Covered Variants | Variant Name | Usage | Project | |
---|---|---|---|---|
Design Patterns | ||||
Adapter | Pluggable Adapters | × | - | |
Two-way Adapters | × | - | ||
Composite | Composites of Composites | ✓ | JH | |
1-N Relationship using arrays | × | - | ||
1-N Relationship using hash tables | × | - | ||
Reference participant | × | - | ||
Supplementary relationship | × | - | ||
Association implementation | × | - | ||
Decorator | Omitting the abstract Decorator class | ✓ | JH | |
Abstract Factory/Factory Method | Different Product types inside Factory class | ✓ | JH, JR | |
Default Product implementation | × | - | ||
Parameterized Factory Method | × | - | ||
One Concrete Creator for all | × | - | ||
Single Concrete class for Product selection without Client | × | - | ||
Observer | Multiple instance Observer | ✓ | JH, QUML | |
Compound implementation | × | - | ||
Singleton | Eager instantiation | ✓ | JH, QUML | |
Lazy instantiation (non-thread safe) | ✓ | JR | ||
Lazy instantiation (thread safe) | × | - | ||
Lazy instantiation with double lock mechanism | ✓ | JR | ||
Replaceable instance | × | - | ||
SubClassed Singleton | × | - | ||
Delegated construction | ✓ | JR | ||
Different placeholder | × | - | ||
Limiton | × | - | ||
State/Strategy | Statemaps | × | - | |
Three-level finite state machine | × | - | ||
Flexible Strategy pattern | × | - | ||
Template method | Enhanced Template design pattern | × | - | |
Visitor | Visitor combinators | × | - | |
Distributed monitoring using Visitor pattern | × | - | ||
Extended Visitor pattern | × | - | ||
Builder | Nested Builder | × | - | |
Prototype | Only has a basic form | - | - | |
Bridge | Cascading Bridge | × | - | |
Folded cascading Bridge | × | - | ||
Partially folded cascading Bridge | × | - | ||
Architectural cascading Bridge | × | - | ||
Bi-directional cascading Bridge | × | - | ||
Façade | Encapsulating layered Facade | × | - | |
Wrapper Facade | × | - | ||
Subsystem Facade | × | - | ||
Flyweight | Constrainedly shared Flyweight | × | - | |
Externalizing extrinsic State | × | - | ||
Proxy | Pipe and filter implementation | × | - | |
Dynamic Proxies | × | - | ||
Chain of Responsibility | Handling strategy | × | - | |
Forwarding strategy | × | - | ||
Bureaucracy pattern | × | - | ||
Command | Basic form only | - | - | |
Interpreter | Only has a basic form | - | - | |
Mediator | Traffic generator Mediator | × | - | |
Iterator | External Iterators | × | - | |
Static structure Iterators | × | - | ||
Nested object Iterator | × | - | ||
Single integral Iterator | × | - | ||
Multiple integral Iterator | × | - | ||
Magic cookie | × | - | ||
External magic cookie Iterator | × | - | ||
Internal Iterator | × | - | ||
Memento | HybridPrM | × | - |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Kouli, M.; Rasoolzadegan, A. A Feature-Based Method for Detecting Design Patterns in Source Code. Symmetry 2022, 14, 1491. https://doi.org/10.3390/sym14071491
Kouli M, Rasoolzadegan A. A Feature-Based Method for Detecting Design Patterns in Source Code. Symmetry. 2022; 14(7):1491. https://doi.org/10.3390/sym14071491
Chicago/Turabian StyleKouli, Mariam, and Abbas Rasoolzadegan. 2022. "A Feature-Based Method for Detecting Design Patterns in Source Code" Symmetry 14, no. 7: 1491. https://doi.org/10.3390/sym14071491
APA StyleKouli, M., & Rasoolzadegan, A. (2022). A Feature-Based Method for Detecting Design Patterns in Source Code. Symmetry, 14(7), 1491. https://doi.org/10.3390/sym14071491