Skip to main content
Log in

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

  • Regular Paper
  • Published:
Journal of Computer Science and Technology Aims and scope Submit manuscript

Abstract

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.

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.

Similar content being viewed by others

References

  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.

    Article  Google Scholar 

  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.

    Article  Google Scholar 

  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.

    Article  Google Scholar 

  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.

    Article  Google Scholar 

  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.

    Article  Google Scholar 

  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.

    Article  Google Scholar 

  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.

    Article  Google Scholar 

  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.

    Article  Google Scholar 

  20. Hasheminejad SM H, Jalili S. Design patterns selection: An automatic two-phase method. J. Syst. Softw., 2012, 85(2): 408-424.

    Article  Google Scholar 

  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.

    Article  Google Scholar 

  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.

    Article  Google Scholar 

  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.

    Article  Google Scholar 

  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.

    Article  Google Scholar 

  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:https://doi.org/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.

    Article  Google Scholar 

  35. Mahmoud A, Bradshaw G. Semantic topic models for source code analysis. Empir. Softw. Eng., 2017, 22(4): 1965-2000.

    Article  Google Scholar 

  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.

    Article  Google Scholar 

  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.

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Zhi-Lei Ren.

Electronic supplementary material

ESM 1

(PDF 158 kb)

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Liu, D., Ren, ZL., Long, ZT. et al. Mining Design Pattern Use Scenarios and Related Design Pattern Pairs: A Case Study on Online Posts. J. Comput. Sci. Technol. 35, 963–978 (2020). https://doi.org/10.1007/s11390-020-0407-4

Download citation

  • Received:

  • Revised:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11390-020-0407-4

Keywords

Navigation