Journal of Computer Science and Technology ›› 2020, Vol. 35 ›› Issue (5): 963-978.doi: 10.1007/s11390-020-0407-4

Special Issue: Software Systems

• Special Section on Software Systems 2020—Part 1 •     Next Articles

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

Dong Liu1, Zhi-Lei Ren1,2,*, Member, CCF, ACM, Zhong-Tian Long3, Guo-Jun Gao1, and He Jiang1,2, Member, CCF, ACM, IEEE        

  1. 1 School of Software, Dalian University of Technology, Dalian 116024, China;
    2 Key Laboratory for Ubiquitous Network and Service Software of Liaoning Province, Dalian 116000, China;
    3 DUT-RU International School of Information Science & Engineering at DUT, Dalian University of Technology Dalian 116620, China
  • Received:2020-02-27 Revised:2020-07-31 Online:2020-09-20 Published:2020-09-29
  • Contact: Zhi-Lei Ren
  • Supported by:
    This work was supported by the National Key Research and Development Program of China under Grant No. 2018YFB1003903, and the National Natural Science Foundation of China under Grant Nos. 61722202 and 61772107.

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.

Key words: design pattern; software documentation; Stack Overflow; topic model;

[1] Zhang C, Budgen D. What do we know about the effectiveness of software design patterns? IEEE Trans. Softw. Eng., 2012, 38(5):1213-1231.
[2] Henninger S, Corrêa V. Software pattern communities:Current practices and challenges. In Proc. the 14th Conf. Patt. Lang. Prog., Sept. 2007, Article No. 14.
[3] Gamma E, Helm R, Johnson R, Vlissides J. Design Patterns:Elements of Reusable Object-Oriented Software (1st edition). Addison-Wesley Professional, 1994.
[4] Buschmann F, Meunier R, Rohnert H, Sommerlad P, Stal M. Pattern-Oriented Software Architecture:A System of Patterns (1st edition). Wiley, 1996.
[5] Barua A, Thomas S W, Hassan A E. What are developers talking about? An analysis of topics and trends in Stack Overflow. Empir. Softw. Eng., 2014, 19(3):619-654.
[6] Ahmad A, Feng C, Ge S, Yousif A. A survey on mining stack overflow:Question and answering (Q&A) community. Data Technol. Appl., 2018, 52(2):190-247.
[7] Hindle A, Godfrey M W, Holt R C. What's hot and what's not:Windowed developer topic analysis. In Proc. the 25th IEEE Int. Conf. Softw. Maint., Sept. 2009, pp.339-348.
[8] Han D, Zhang C, Fan X, Hindle A, Wong K, Stroulia E. Understanding Android fragmentation with topic analysis of vendor-specific bugs. In Proc. the 19th Working Conf. Reverse Eng., Oct. 2012, pp.83-92.
[9] Bagherzadeh M, Khatchadourian R. Going big:A largescale study on what big data developers ask. In Proc. the 27th ACM Joint Eur. Softw. Eng. Conf./Symp. Found. Softw. Eng., Aug. 2019, pp.432-442.
[10] Zhou P, Liu J, Yang Z, Zhou G. Scalable tag recommendation for software information sites. In Proc. the 24th IEEE Int. Conf. Softw. Anal. Evol. Reeng., Feb. 2017, pp.272-282.
[11] Chen C, Gao S, Xing Z. Mining analogical libraries in Q&A discussions-Incorporating relational and categorical knowledge into word embedding. In Proc. the 23rd IEEE Int. Conf. Softw. Anal. Evol. Reeng., Mar. 2016, pp.338-348.
[12] Wang X Y, Xia X, Lo D. TagCombine:Recommending tags to contents in software information sites. J. Comput. Sci. Technol., 2015, 30(5):1017-1035.
[13] Zhang Y, Lo D, Xia X, Sun J L. Multi-factor duplicate question detection in Stack Overflow. J. Comput. Sci. Technol., 2015, 30(5):981-997.
[14] Jiang H, Liu D, Chen X, Liu H, Mei H. How are design patterns concerned by developers? In Proc. the 41st Int. Conf. Softw. Eng. Comp., May 2019, pp.232-233.
[15] Yang X L, Lo D, Xia X, Wan Z Y, Sun J L. What security questions do developers ask? A large-scale study of Stack Overflow posts. J. Comput. Sci. Technol., 2016, 31(5):910-924.
[16] Yin J, Wang J. A Dirichlet multinomial mixture modelbased approach for short text clustering. In Proc. the 20th ACM Int. Conf. Knowl. Disc. Data Mining, Aug. 2014, pp.233-242.
[17] Griffiths T L, Steyvers M. Finding scientific topics. Proc. National Academy Sci., 2004, 101(suppl. 1):5228-5235.
[18] Satopaa V, Albrecht J, Irwin D, Raghavan B. Finding a "Kneedle" in a haystack:Detecting knee points in system behavior. In Proc. the 31st Int. Conf. Distrt. Comput. Syst. Workshops, June 2011, pp.166-171.
[19] Rosen C, Shihab E. What are mobile developers asking about? A large scale study using Stack Overflow. Empir. Softw. Eng., 2016, 21:1192-1223.
[20] Hasheminejad S M H, Jalili S. Design patterns selection:An automatic two-phase method. J. Syst. Softw., 2012, 85(2):408-424.
[21] Scanniello G, Gravino C, Risi M, Tortora G, Dodero G. Documenting design-pattern instances:A family of experiments on source-code comprehensibility. ACM Trans. Softw. Eng. Methodol., 2015, 24(3):Article No. 14.
[22] Ampatzoglou A, Chatzigeorgiou A, Charalampidou S, Avgeriou P. The effect of GoF design patterns on stability:A case study. IEEE Trans. Softw. Eng., 2015, 41(8):781-802.
[23] Hussain S, Keung J, Khan A A, Bennin K E. Correlation between the frequent use of gang-of-four design patterns and structural complexity. In Proc. the 24th Asia-Pacific Softw. Eng. Conf., Dec. 2017, pp.189-198.
[24] 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(3):896-931.
[25] Aversano L, Cerulo L, Di Penta M. Relationship between design patterns defects and crosscutting concern scattering degree:An empirical study. IET Softw., 2009, 3(5):395-409.
[26] Zou J, Xu L, Yang M, Zhang X, Yang D. Towards comprehending the non-functional requirements through developers' eyes:An exploration of Stack Overflow using topic analysis. Inf. Softw. Technol., 2017, 84:19-32.
[27] Nagy C, Cleve A. Mining Stack Overflow for discovering error patterns in SQL queries. In Proc. the 7th IEEE Int. Conf. Softw. Maint. Evolut., Sept. 2015, pp.516-520.
[28] Zhang T, Upadhyaya G, Reinhardt A, Rajan H, Kim M. Are code examples on an online Q&A forum reliable? A study of API misuse on Stack Overflow. In Proc. the 40th Int. Conf. Softw. Eng., May 2018, pp.886-896.
[29] Rahman A, Farhana E, Imtiaz N. Snakes in paradise? Insecure python-related coding practices in Stack Overflow. In Proc. the 16th IEEE/ACM Int. Conf. Mining Softw. Repos., May 2019, pp.200-204.
[30] Ford D, Smith J, Guo P J, Parnin C. Paradise unplugged:Identifying barriers for female participation on Stack Overflow. In Proc. the 24th ACM Joint Eur. Softw. Eng. Conf./Symp. Found. Softw. Eng., Nov. 2016, pp.846-857.
[31] Zhang H, Wang S, Chen T P, Zou Y, Hassan A E. An empirical study of obsolete answers on Stack Overflow. IEEE Trans. Softw. Eng.. doi:10.1109/TSE.2019.2906315.
[32] Marder A. Stack Overflow badges and user behavior:An econometric approach. In Proc. the 12th IEEE/ACM Int. Conf. Mining Softw. Repos., May 2015, pp.450-453.
[33] Thomas S W, Adams B, Hassan A E, Blostein D. Validating the use of topic models for software evolution. In Proc. the 10th IEEE Working Conf. Source Code Anal. Manip., Sept. 2010, pp.55-64.
[34] Fowkes J, Chanthirasegaran P, Ranca R, Allamanis M, Lapata M, Sutton C. Autofolding for source code summarization. IEEE Trans. Softw. Eng., 2017, 43(12):1095-1109.
[35] Mahmoud A, Bradshaw G. Semantic topic models for source code analysis. Empir. Softw. Eng., 2017, 22(4):1965-2000.
[36] Xia X, Lo D, Ding Y, Al-Kofahi J M, Nguyen T N, Wang X. Improving automated bug triaging with specialized topic model. IEEE Trans. Softw. Eng., 2017, 43(3):272-297.
[37] Jiang H, Zhang J, Ren Z, Zhang T. An unsupervised approach for discovering relevant tutorial fragments for APIs. In Proc. the 39th Int. Conf. Softw. Eng., May 2017, pp.38-48.
[38] Hu J, Sun X, Li B. Explore the evolution of development topics via on-line LDA. In Proc. the 22nd IEEE Int. Conf. Softw. Anal. Evol. Reeng., Mar. 2015, pp.555-559.
[1] Jung-Been Lee, Taek Lee, Hoh Peter In. Topic Modeling Based Warning Prioritization from Change Sets of Software Repository [J]. Journal of Computer Science and Technology, 2020, 35(6): 1461-1479.
[2] Sai-Sai Gong, Wei Hu, Wei-Yi Ge, Yu-Zhong Qu. Modeling Topic-Based Human Expertise for Crowd Entity Resolution [J]. Journal of Computer Science and Technology, 2018, 33(6): 1204-1218.
[3] Yang Li, Wen-Zhuo Song, Bo Yang. Stochastic Variational Inference-Based Parallel and Online Supervised Topic Model for Large-Scale Text Processing [J]. Journal of Computer Science and Technology, 2018, 33(5): 1007-1022.
[4] Fei-Fei Kou, Jun-Ping Du, Cong-Xian Yang, Yan-Song Shi, Wan-Qiu Cui, Mei-Yu Liang, Yue Geng. Hashtag Recommendation Based on Multi-Features of Microblogs [J]. , 2018, 33(4): 711-726.
[5] Peng-Peng Zhao, Hai-Feng Zhu, Yanchi Liu, Zi-Ting Zhou, Zhi-Xu Li, Jia-Jie Xu, Lei Zhao, Victor S. Sheng. A Generative Model Approach for Geo-Social Group Recommendation [J]. , 2018, 33(4): 727-738.
[6] Tie-Ke He, Hao Lian, Ze-Min Qin, Zhen-Yu Chen, Bin Luo. PTM: A Topic Model for the Inferring of the Penalty [J]. , 2018, 33(4): 756-767.
[7] Xin-Li Yang, David Lo, Xin Xia, Zhi-Yuan Wan, Jian-Ling Sun. What Security Questions Do Developers Ask? A Large-Scale Study of Stack Overflow Posts [J]. , 2016, 31(5): 910-924.
[8] Xi-Ming Li, Ji-Hong Ouyang. Tuning the Learning Rate for Stochastic Variational Inference [J]. , 2016, 31(2): 428-436.
[9] Hoon Park, Anping He, Marly Roncken, Xiaoyu Song, Ivan Sutherland. Modular Timing Constraints for Delay-Insensitive Systems [J]. , 2016, 31(1): 77-106.
[10] Yun Zhang, David Lo, Xin Xia, Jian-Ling Sun. Multi-Factor Duplicate Question Detection in Stack Overflow [J]. , 2015, 30(5): 981-997.
[11] Yong-Xin Tong, Jieying She, Lei Chen. Towards Better Understanding of App Functions [J]. , 2015, 30(5): 1130-1140.
[12] Peng Li (李鹏), Bin Wang (王斌), Senior Member, CCF, Member, ACM, IEEE, and Wei Jin (晋薇). ImprovingWeb Document Clustering through Employing User-Related Tag Expansion Techniques [J]. , 2012, 27(3): 554-566.
[13] Feng Jin (金锋), Min-Lie Huang (黄民烈),and Xiao-Yan Zhu (朱小燕), Member, CCF. Guided Structure-Aware Review Summarization [J]. , 2011, 26(4): 676-684.
[14] Chao-Sheng Lin (林朝圣), Chun-Hsien Lu (吕俊贤), Shang-Wei Lin (林尚威), Yean-Ru Chen (陈盈如), and Pao-Ann Hsiung (熊博安), Senior Member, ACM, IEEE. VERTAF/Multi-Core: A SysML-Based Application Framework for Multi-Core Embedded Software Development [J]. , 2011, 26(3): 448-462.
[15] Wei-Feng Pan (潘伟丰), Member, CCF, Bing Li (李兵), Senior Member, CCF, Yu-Tao Ma (马于涛), Member, CCF, ACM, Ye-Yi Qin (覃叶宜) and Xiao-Yan Zhou (周晓燕). Measuring Structural Quality of Object-Oriented Softwares via Bug Propagation Analysis on Weighted Software Networks [J]. , 2010, 25(6): 1202-1213.
Full text



[1] Li Wanxue;. Almost Optimal Dynamic 2-3 Trees[J]. , 1986, 1(2): 60 -71 .
[2] C.Y.Chung; H.R.Hwa;. A Chinese Information Processing System[J]. , 1986, 1(2): 15 -24 .
[3] Zhang Cui; Zhao Qinping; Xu Jiafu;. Kernel Language KLND[J]. , 1986, 1(3): 65 -79 .
[4] Min Yinghua; Han Zhide;. A Built-in Test Pattern Generator[J]. , 1986, 1(4): 62 -74 .
[5] Huang Xuedong; Cai Lianhong; Fang Ditang; Chi Bianjin; Zhou Li; Jiang Li;. A Computer System for Chinese Character Speech Input[J]. , 1986, 1(4): 75 -83 .
[6] Shi Zhongzhi;. Knowledge-Based Decision Support System[J]. , 1987, 2(1): 22 -29 .
[7] Tang Tonggao; Zhao Zhaokeng;. Stack Method in Program Semantics[J]. , 1987, 2(1): 51 -63 .
[8] Xia Peisu; Fang Xinwo; Wang Yuxiang; Yan Kaiming; Zhang Tingjun; Liu Yulan; Zhao Chunying; Sun Jizhong;. Design of Array Processor Systems[J]. , 1987, 2(3): 163 -173 .
[9] Sun Yongqiang; Lu Ruzhan; Huang Xiaorong;. Termination Preserving Problem in the Transformation of Applicative Programs[J]. , 1987, 2(3): 191 -201 .
[10] Shi Weigeng; StephenY.H.Su;. An Online Diagnosable Fault-Tolerant Redundancy System[J]. , 1987, 2(4): 310 -321 .

ISSN 1000-9000(Print)

CN 11-2296/TP

Editorial Board
Author Guidelines
Journal of Computer Science and Technology
Institute of Computing Technology, Chinese Academy of Sciences
P.O. Box 2704, Beijing 100190 P.R. China
  Copyright ©2015 JCST, All Rights Reserved