Exploration and Practice of Code Commenting Based on Prompt Engineering

This paper investigates the application of code comment generation technology based on Prompt Engineering in software development. With the increasing scale and complexity of software projects, traditional manual code commenting methods face issues of low efficiency and unstable quality. To address these challenges, we employ Prompt Engineering to design precise prompts that guide Large Language Models (LLMs) to automatically generate high-quality code comments. In this paper, we primarily utilized ChatGPT-4 and designed a code comment generation process for C language code based on Prompt Engineering. The experimental validation shows that this method is highly efficient in generating accurate and consistent comments. Additionally, this proposed approach has been applied to parse comments for erroneous code, assisting developers in quickly locating and fixing problems. The experimental results demonstrate that the method based on Prompt Engineering can significantly enhance the quality of code comments and development efficiency. It also provides new ideas and tools for software development and programming education.

Authors

Institutions

Publication Details

Published
2025-04-18
DOI
https://doi.org/10.1109/cste64638.2025.11092128
Primary Topic
Educational Technology and Assessment
Type
article
Field-Weighted Citation Impact
0.00

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Exploration and Practice of Code Commenting Based on Prompt Engineering

Yanhuai Ding, Bingshu Wang, Han Zhang, Shuyi Li
Educational Technology and Assessment
article

Exploration and Practice of Code Commenting Based on Prompt Engineering

Yanhuai Ding, Bingshu Wang, Han Zhang, Shuyi Li
article en

Abstract

This paper investigates the application of code comment generation technology based on Prompt Engineering in software development. With the increasing scale and complexity of software projects, traditional manual code commenting methods face issues of low efficiency and unstable quality. To address these challenges, we employ Prompt Engineering to design precise prompts that guide Large Language Models (LLMs) to automatically generate high-quality code comments. In this paper, we primarily utilized ChatGPT-4 and designed a code comment generation process for C language code based on Prompt Engineering. The experimental validation shows that this method is highly efficient in generating accurate and consistent comments. Additionally, this proposed approach has been applied to parse comments for erroneous code, assisting developers in quickly locating and fixing problems. The experimental results demonstrate that the method based on Prompt Engineering can significantly enhance the quality of code comments and development efficiency. It also provides new ideas and tools for software development and programming education.

Northwestern Polytechnical University (CN), Beijing University of Technology (CN)
Northwestern Polytechnical University
Openalex Percentile: Top 70%
Educational Technology and Assessment
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Exploration and Practice of Code Commenting Based on Prompt Engineering — Yanhuai Ding, Bingshu Wang, et al. · (2025) | TGRS Research Map | TGRS