Loading [MathJax]/extensions/MathZoom.js
Can Developers Prompt? A Controlled Experiment for Code Documentation Generation | IEEE Conference Publication | IEEE Xplore

Can Developers Prompt? A Controlled Experiment for Code Documentation Generation


Abstract:

Large language models (LLMs) bear great potential for automating tedious development tasks such as creating and maintaining code documentation. However, it is unclear to ...Show More

Abstract:

Large language models (LLMs) bear great potential for automating tedious development tasks such as creating and maintaining code documentation. However, it is unclear to what extent developers can effectively prompt LLMs to create concise and useful documentation. We report on a controlled experiment with 20 professionals and 30 computer science students tasked with code documentation generation for two Python functions. The experimental group freely entered ad-hoc prompts in a Chat- GPT-like extension of Visual Studio Code, while the control group executed a predefined few-shot prompt. Our results reveal that professionals and students were unaware of or unable to apply prompt engineering techniques. Especially students perceived the documentation produced from ad-hoc prompts as significantly less readable, less concise, and less helpful than documentation from prepared prompts. Some professionals produced higher quality documentation by just including the keyword Docstring in their ad-hoc prompts. While students desired more support in formulating prompts, professionals appreciated the flexibility of ad-hoc prompting. Participants in both groups rarely assessed the output as perfect. Instead, they understood the tools as support to iteratively refine the documentation. Further research is needed to understand which prompting skills and preferences developers have and which support they need for certain tasks.
Date of Conference: 06-11 October 2024
Date Added to IEEE Xplore: 19 December 2024
ISBN Information:

ISSN Information:

Conference Location: Flagstaff, AZ, USA
References is not available for this document.

I. Introduction

Developers often overlook or ignore software documentation and generally assign it a low priority [1]. Yet, carefully documenting code is an essential task in software engineering. Up-to-date and high-quality documentation facilitates program comprehension [2], accelerates developer onboarding [3], [4], and mitigates technical debt [5]. Software documentation is also central to software maintenance, as documentation often requires updates and should evolve with software [6].

Select All
1.
E. Aghajani, C. Nagy, O. L. Vega-Marquez, M. Linares-Vasquez, L. Moreno, G. Bavota, et al., "Software documentation issues unveiled", 2019 IEEE/ACM 41st International Conference on Software Engineering, pp. 1199-1210, 2019.
2.
T. Roehm, R. Tiarks, R. Koschke and W. Maalej, "How do professional developers comprehend software?", 2012 34th International Conference on Software Engineering, pp. 255-265, 2012.
3.
I. Steinmacher, C. Treude and M. A. Gerosa, "Let me in: Guidelines for the successful onboarding of newcomers to open source projects", IEEE Software, vol. 36, no. 4, pp. 41-49, 2019.
4.
C. Stanik, L. Montgomery, D. Martens, D. Fucci and W. Maalej, "A simple NLP-based approach to support onboarding and retention in open source communities", 2018 IEEE International Conference on Software Maintenance and Evolution, pp. 172-182, 2018.
5.
F. Zampetti, G. Fucci, A. Serebrenik and M. Di Penta, "Self-admitted technical debt practices: A comparison between industry and open-source", Empirical Software Engineering, vol. 26, no. 6, pp. 1-32, 2021.
6.
E. Aghajani, C. Nagy, M. Linares-Vasquez, L. Moreno, G. Bavota, M. Lanza, et al., "Software documentation: The prac-titioners' perspective", Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering, pp. 590-601, 2020.
7.
S. Rai, R. C. Belwal and A. Gupta, "A review on source code documentation", ACM Transactions on Intelligent Systems and Technology, vol. 13, no. 5, Jun. 2022.
8.
S. Bubeck, V. Chandrasekaran, R. Eldan, J. Gehrke, E. Horvitz, E. Ka-mar, et al., Sparks of artificial general intelligence: Early experiments with GPT-4, 2023.
9.
C. Ebert and P. Louridas, "Generative AI for software practitioners", IEEE Software, vol. 40, no. 4, pp. 30-38, 2023.
10.
H. Tian, W. Lu, T. O. Li, X. Tang, S.-C. Cheung, J. Klein, et al., Is ChatGPT the ultimate programming assistant - how far is it?, 2023.
11.
M. Wermelinger, "Using GitHub Copilot to solve simple programming problems", Proceedings of the 54th ACM Technical Symposium on Computer Science Education V. 1, pp. 172-178, 2023.
12.
P. Liu, W. Yuan, J. Fu, Z. Jiang, H. Hayashi and G. Neubig, "Pre-train prompt and predict: A systematic survey of prompting methods in natural language processing", ACM Computing Surveys, vol. 55, no. 9, Jan. 2023.
13.
S. Schulhoff, M. Ilie, N. Balepur, K. Kahadze, A. Liu, C. Si, et al., The prompt report: A systematic survey of prompting techniques, 2024.
14.
J. White, Q. Fu, S. Hays, M. Sandborn, C. Olea, H. Gilbert, et al., A prompt pattern catalog to enhance prompt engineering with ChatGPT, 2023.
15.
"OpenAI", Prompt engineering. OpenAI L.L.C, 2024, [online] Available: https://platform.openai.com/docs/guides/prompt-engineering.
16.
T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, et al., "Language models are few-shot learners" in Advances in Neural Information Processing Systems, Red Hook, NY, USA:Curran Associates, Inc., vol. 33, pp. 1877-1901, 2020.
17.
R. Logan, I. Balazevic, E. Wallace, F. Petroni, S. Singh and S. Riedel, "Cutting down on prompts and parameters: Simple few-shot learning with language models" in Findings of the Association for Computational Linguistics: ACL 2022, Dublin, Ireland:Association for Computational Linguistics, pp. 2824-2835, May 2022.
18.
T. Ahmed and P. Devanbu, "Few-shot training LLMs for project-specific code-summarization", Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering, 2023.
19.
X. Hu, Q. Chen, H. Wang, X. Xia, D. Lo and T. Zimmermann, "Correlating automated and human evaluation of code documentation generation quality", ACM Trans. Softw. Eng. Methodol., vol. 31, no. 4, Jul. 2022.
20.
H.-A. Kruse, T. PuhlfurB and W. Maalej, Can developers prompt? a controlled experiment for code documentation generation [replication package], 2024.
21.
C. Wohlin, P. Runeson, M. Host, M. C. Ohlsson, B. Regnell and A. Wesslen, Experimentation in software engineering, Berlin, Hei-delberg:Springer, 2012.
22.
O. Alhadreti and P. Mayhew, "Rethinking thinking aloud: A comparison of three think-aloud protocols", Proceedings of the 2018 CHI Conference on Human Factors in Computing Systems, pp. 1-12, 2018.
23.
S. Kapil, Clean Python, Berkeley, CA, USA:Apress, 2019.
24.
B. Laugwitz, T. Held and M. Schrepp, "Construction and evaluation of a user experience questionnaire" in HCI and Usability for Education and Work, Berlin, Heidelberg:Springer Berlin Heidelberg, pp. 63-76, 2008.
25.
R. Macefield, "Usability studies and the Hawthorne effect", J. Usability Studies, vol. 2, no. 3, pp. 145-154, May 2007.
26.
2024, [online] Available: https://github.com/European-XFEL/Karabo/.
27.
P. Rani, A. Blasi, N. Stulova, S. Panichella, A. Gorla and O. Nierstrasz, "A decade of code comment quality assessment: A systematic literature review", Journal of Systems and Software, vol. 195, pp. 111515, 2023.
28.
X. Hou, Y. Zhao, Y. Liu, Z. Yang, K. Wang, L. Li, et al., Large language models for software engi-neering: A systematic literature review, 2023.
29.
W. Sun, C. Fang, Y. You, Y. Miao, Y. Liu, Y. Li, et al., Automatic code summarization via ChatGPT: How far are we?, 2023.
30.
Z. Renyang, 2023, [online] Available: https://marketplace.visualstudio.com/items?itemName=zhang-renyang.chat-gpt.

Contact IEEE to Subscribe

References

References is not available for this document.