Mining Design Pattern Use Scenarios and Related Design Pattern Pairs: A Case Study on Online Posts

In common design pattern collections, e.g., design pattern books, design patterns are documented with templates that consist of multiple attributes, such as intent, structure, and sample code. To adapt to modern developers, the depictions of design patterns, especially some specific attributes, should advance with the current programming technologies, for example, “known uses”, which exemplifies the use scenarios of design patterns in practice, and “related patterns”, which describes the relatedness between a design pattern and the others within a context. However, it is not easy to update the contents of these attributes manually due to the diversity of the programming technologies. To address this problem, in this work, we conducted a case study to mine design pattern use scenarios and related design pattern pairs from Stack Overflow posts to enrich the two attributes. We first extracted the question posts relevant to each design pattern by identifying the design pattern tags. Then, the topics of the posts were discovered by applying topic modeling techniques. Finally, by analyzing the topics specified for each design pattern, we detected 195 design pattern use scenarios and 70 related design pattern pairs, involving 61 design patterns totally. These findings are associated with a variety of popular software frameworks and programming techniques. They could complement the existing design pattern collections and help developers better acknowledge the usage and relatedness of design patterns in today’s programming practice.

[1]  David Lo,et al.  TagCombine: Recommending Tags to Contents in Software Information Sites , 2015, Journal of Computer Science and Technology.

[2]  Raffi Khatchadourian,et al.  Going big: a large-scale study on what big data developers ask , 2019, ESEC/SIGSOFT FSE.

[3]  Effat Farhana,et al.  Snakes in Paradise?: Insecure Python-Related Coding Practices in Stack Overflow , 2019, 2019 IEEE/ACM 16th International Conference on Mining Software Repositories (MSR).

[4]  Saeed Jalili,et al.  Design patterns selection: An automatic two-phase method , 2012, J. Syst. Softw..

[5]  Jin Liu,et al.  Scalable tag recommendation for software information sites , 2017, 2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER).

[6]  Giuseppe Scanniello,et al.  Documenting Design-Pattern Instances: A Family of Experiments on Source-Code Comprehensibility , 2015, TSEM.

[7]  Miryung Kim,et al.  Are Code Examples on an Online Q&A Forum Reliable?: A Study of API Misuse on Stack Overflow , 2018, 2018 IEEE/ACM 40th International Conference on Software Engineering (ICSE).

[8]  Emad Shihab,et al.  What are mobile developers asking about? A large scale study using stack overflow , 2016, Empirical Software Engineering.

[9]  Xinli Yang,et al.  What Security Questions Do Developers Ask? A Large-Scale Study of Stack Overflow Posts , 2016, Journal of Computer Science and Technology.

[10]  Scott Henninger,et al.  Software pattern communities: current practices and challenges , 2007, PLOP '07.

[11]  Andrew Marder Stack Overflow Badges and User Behavior: An Econometric Approach , 2015, 2015 IEEE/ACM 12th Working Conference on Mining Software Repositories.

[12]  B. F. Castro Buschmann, Frank; Meunier, Regine; Rohnert, Hans; Sommerlad, Peter; Stal, Michael. Pattern-oriented software architecture: a system of patterns, John Wiley & Sons Ltd, 1996 , 1997 .

[13]  Cheng Zhang,et al.  What Do We Know about the Effectiveness of Software Design Patterns? , 2012, IEEE Transactions on Software Engineering.

[14]  Mark Steyvers,et al.  Finding scientific topics , 2004, Proceedings of the National Academy of Sciences of the United States of America.

[15]  Ling Xu,et al.  Towards comprehending the non-functional requirements through Developers' eyes: An exploration of Stack Overflow using topic analysis , 2017, Inf. Softw. Technol..

[16]  Foutse Khomh,et al.  Evaluating the impact of design pattern and anti-pattern dependencies on changes and faults , 2015, Empirical Software Engineering.

[17]  Haoxiang Zhang,et al.  An Empirical Study of Obsolete Answers on Stack Overflow , 2019, IEEE Transactions on Software Engineering.

[18]  Zhenchang Xing,et al.  Mining Analogical Libraries in Q&A Discussions -- Incorporating Relational and Categorical Knowledge into Word Embedding , 2016, 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER).

[19]  Eleni Stroulia,et al.  Understanding Android Fragmentation with Topic Analysis of Vendor-Specific Bugs , 2012, 2012 19th Working Conference on Reverse Engineering.

[20]  Tao Zhang,et al.  An Unsupervised Approach for Discovering Relevant Tutorial Fragments for APIs , 2017, 2017 IEEE/ACM 39th International Conference on Software Engineering (ICSE).

[21]  Ahmed E. Hassan,et al.  Validating the Use of Topic Models for Software Evolution , 2010, 2010 10th IEEE Working Conference on Source Code Analysis and Manipulation.

[22]  Michael W. Godfrey,et al.  What's hot and what's not: Windowed developer topic analysis , 2009, 2009 IEEE International Conference on Software Maintenance.

[23]  Chong Feng,et al.  A survey on mining stack overflow: question and answering (Q&A) community , 2018, Data Technol. Appl..

[24]  C Haythornwaite,et al.  Gamma, E., Helm, R., Johnson, R. & Vlissides, J. Design Patterns: Elements of Reusable Object Oriented Software. New York: Addison-Wesley, 1995. , 2002 .

[25]  Jianyong Wang,et al.  A dirichlet multinomial mixture model-based approach for short text clustering , 2014, KDD.

[26]  Apostolos Ampatzoglou,et al.  The Effect of GoF Design Patterns on Stability: A Case Study , 2015, IEEE Transactions on Software Engineering.

[27]  Lerina Aversano,et al.  Relationship between design patterns defects and crosscutting concern scattering degree: an empirical study , 2009, IET Softw..

[28]  David Lo,et al.  Improving Automated Bug Triaging with Specialized Topic Model , 2017, IEEE Transactions on Software Engineering.

[29]  David E. Irwin,et al.  Finding a "Kneedle" in a Haystack: Detecting Knee Points in System Behavior , 2011, 2011 31st International Conference on Distributed Computing Systems Workshops.

[30]  Philip J. Guo,et al.  Paradise unplugged: identifying barriers for female participation on stack overflow , 2016, SIGSOFT FSE.

[31]  Bin Li,et al.  Explore the evolution of development topics via on-line LDA , 2015, 2015 IEEE 22nd International Conference on Software Analysis, Evolution, and Reengineering (SANER).

[32]  Ahmed E. Hassan,et al.  What are developers talking about? An analysis of topics and trends in Stack Overflow , 2014, Empirical Software Engineering.

[33]  David Lo,et al.  Multi-Factor Duplicate Question Detection in Stack Overflow , 2015, Journal of Computer Science and Technology.

[34]  Arif Ali Khan,et al.  Correlation between the Frequent Use of Gang-of-Four Design Patterns and Structural Complexity , 2017, 2017 24th Asia-Pacific Software Engineering Conference (APSEC).

[35]  Anthony Cleve,et al.  Mining Stack Overflow for discovering error patterns in SQL queries , 2015, 2015 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[36]  Anas Mahmoud,et al.  Semantic topic models for source code analysis , 2017, Empirical Software Engineering.

[37]  Dong Liu,et al.  How Are Design Patterns Concerned by Developers? , 2019, 2019 IEEE/ACM 41st International Conference on Software Engineering: Companion Proceedings (ICSE-Companion).

[38]  Mirella Lapata,et al.  Autofolding for Source Code Summarization , 2014, IEEE Transactions on Software Engineering.