Can Developers Prompt? A Controlled Experiment for Code Documentation Generation

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Kruse, Hans-Alexander, Puhlfürß, Tim, Maalej, Walid
Formato: Preprint
Publicado: 2024
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866916830501666816
author Kruse, Hans-Alexander
Puhlfürß, Tim
Maalej, Walid
author_facet Kruse, Hans-Alexander
Puhlfürß, Tim
Maalej, Walid
contents 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 ChatGPT-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.
format Preprint
id arxiv_https___arxiv_org_abs_2408_00686
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Can Developers Prompt? A Controlled Experiment for Code Documentation Generation
Kruse, Hans-Alexander
Puhlfürß, Tim
Maalej, Walid
Artificial Intelligence
Human-Computer Interaction
Software Engineering
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 ChatGPT-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.
title Can Developers Prompt? A Controlled Experiment for Code Documentation Generation
topic Artificial Intelligence
Human-Computer Interaction
Software Engineering
url https://arxiv.org/abs/2408.00686