GPTutor: a ChatGPT-powered programming tool for code explanation
Eason Chen,Ray Huang,Han-Shin Chen,Yuen-Hsien Tseng,Liang-Yi Li
2023-06-15
Abstract:Learning new programming skills requires tailored guidance. With the emergence of advanced Natural Language Generation models like the ChatGPT API, there is now a possibility of creating a convenient and personalized tutoring system with AI for computer science education. This paper presents GPTutor, a ChatGPT-powered programming tool, which is a Visual Studio Code extension using the ChatGPT API to provide programming code explanations. By integrating Visual Studio Code API, GPTutor can comprehensively analyze the provided code by referencing the relevant source codes. As a result, GPTutor can use designed prompts to explain the selected code with a pop-up message. GPTutor is now published at the Visual Studio Code Extension Marketplace, and its source code is openly accessible on GitHub. Preliminary evaluation indicates that GPTutor delivers the most concise and accurate explanations compared to vanilla ChatGPT and GitHub Copilot. Moreover, the feedback from students and teachers indicated that GPTutor is user-friendly and can explain given codes satisfactorily. Finally, we discuss possible future research directions for GPTutor. This includes enhancing its performance and personalization via further prompt programming, as well as evaluating the effectiveness of GPTutor with real users.
Human-Computer Interaction,Artificial Intelligence,Computation and Language,Software Engineering
What problem does this paper attempt to address?
This paper attempts to solve several key problems in programming learning and code understanding:
1. **Lack of personalized programming guidance**: With the increasing demand for programming skills, many students and novice programmers lack personalized guidance during the learning process. Especially in the classroom, teacher resources are limited and cannot provide customized help for each student.
2. **Deficiencies in code - explanation tools**: Existing code - explanation tools (such as vanilla ChatGPT and GitHub Copilot) have some limitations:
- **Shallow explanations**: They can only provide explanations based on the code in the current file and may ignore or speculate on the domain logic behind the functions.
- **Redundant or inaccurate information**: They may provide too much irrelevant or fictional information.
- **Lack of timely updates**: For new or unpopular libraries, the explanations may not be accurate enough or may be completely missing.
3. **Challenges for novice programmers after joining the company**: When new employees read code written by others, they often encounter difficult - to - understand business logic, code lacking comments or poorly maintained code, which makes it difficult for them to get started quickly.
To solve these problems, the paper proposes **GPTutor**, a plugin based on Visual Studio Code that uses the ChatGPT API to provide detailed code explanations. By integrating the Visual Studio Code API, GPTutor can comprehensively analyze the provided code and use well - designed prompts to explain selected code snippets. Preliminary evaluations show that GPTutor provides more concise and accurate explanations compared to other tools, and user feedback also shows that it is easy to use and the explanations are satisfactory.
### Main contributions
1. **Developed GPTutor**: A Visual Studio Code extension that uses OpenAI's ChatGPT API to provide detailed code explanations.
2. **Demonstrated the superiority of GPTutor**: Through advanced prompt design, GPTutor outperforms vanilla ChatGPT and GitHub Copilot in code explanation.
3. **Discussed future research directions**: Including further optimizing prompt design to improve performance and personalize the experience, and evaluating the effectiveness of GPTutor in practical applications.
Through these improvements, GPTutor aims to provide better support for programming learners and practitioners, enhancing their programming understanding and efficiency.