Leveraging GitHub Co-pilot to Enhance Programming Education

Overview

Introductory programming courses are the foundation for students to gain fundamental coding abilities and analytical thinking skills required for various fields. However, programming poses unique challenges for beginners, like struggling with syntax, grasping complex concepts and developing logical reasoning. As computer science education continues to evolve, AI-powered tools like GitHub Copilot are emerging that can augment programming instruction for novices.

This blog post explores how GitHub Copilot could be effectively integrated into introductory programming courses to enhance student outcomes. Relevant education literature is drawn upon to support the recommendations.

An Introduction to GitHub Copilot

GitHub Copilot is a relatively new AI pair programmer that suggests complete lines of code, functions, and entire code blocks based on comments and the code context. It is powered by Codex, a large deep-learning model trained on billions of lines of public code from GitHub repositories. Copilot employs natural language processing, neural code synthesis, and semantic code search to generate helpful code recommendations tailored to the programmer’s intent. Copilot is a Visual Studio Code extension that integrates into the coding workflow. At its core, it transforms a natural language problem statement into executable code. It aims to boost programmer productivity by reducing boilerplate code and suggesting subsequent lines. Here’s a quick demo:

Advantages of Using Copilot for Introductory Programming Education

Copilot has several characteristics that make it well-suited for enhancing student outcomes in introductory programming courses.

Firstly, it assists with syntax. Beginners often struggle with syntax rules and tedious boilerplate code, such as import statements, which slow learning. Copilot speeds development by handling repetitive code, allowing students to concentrate on higher-level problem-solving.

Secondly, Copilot provides varied examples. Giving several possible output suggestions for a piece of code from a comment enables students to select the best code required, much like a built-in multiple-choice question. Exposure to diverse examples aids conceptual understanding according to constructivist learning theories. The numerous code suggestions from Copilot illustrate varied programming approaches, which require students to analyze each one to fit their needs, thereby promoting language learning.

Many CS curriculums fall short due to little attention given to debugging and problem-solving. As of this writing, the beta version of Copilot chat has features that fix broken code (/fix command) and explains a block of code (/explain command). This is incredibly useful for finding bugs and suggesting changes, keeping student motivation high by mitigating frustrations from debugging errors. The explanation feature helps students work comfortably with legacy code, i.e., code that is undocumented and generally difficult to read and understand. Acting much like a virtual teaching assistant increases the learning rate.

Plagiarism Concerns

Lau & Guo (2023) present findings from interviews with 20 instructors across 9 countries in early 2023, right after ChatGPT’s public release. This captures a unique snapshot before best practices have converged. In the short-term, many instructors are concerned about cheating and have reacted by banning AI tools, weighing exams more heavily, or exposing students to AI capabilities/limitations. Most agree that in the longer term, CS educators must learn to embrace these tools opinions diverge on whether to resist or embrace AI tools by integrating tools into courses to prepare students for using AI in future jobs. New assignments could have students collaborate with AI.

In my testing, I have found that manual intervention is still needed to produce functional code (as you can see from the video above). Nguyen & Nadi (2022) found that out of 33 programming problems from LeetCode, a popular competitive programming practice site, Copilot produced a correct answer 57% in Java, compared to only 27% of the time in JavaScript. This means proper tool use requires students to learn and apply the language’s nuances. We should note that this tool is made for the programmer to lessen their workload. Tools like Intelli-sense and extensions for specific languages already exist that do similar things. It is important to remind students that the goal is to learn the language; this tool will help them get there. It is still essential to learn things like modularization, design, and other programming abstractions as a CS student. Copilot is a great tool to give students a close enough answer and for them to figure out the rest of the code. This requires an understanding beyond what can be taught in the classroom.

Strategies for Productive Use of Copilot in Introductory Programming Courses

I believe Github Copilot should not be used in assessments in first-year courses due to its ease of use for basic programming problems. However, in later courses, once students become more familiar with language syntax and proper software design techniques, it can be used to solve more elaborate problems. I think Copilot will allow students in upper-division courses to express what they’ve learned rather than getting bogged down by syntax.

Still, to leverage Copilot effectively, instructors should provide guidance on integrating it into the learning objectives. Here are some best practices. First, let Copilot provide hints, not complete solutions. Encourage students to trace through Copilot code proposals line-by-line manually to build understanding rather than passively accepting suggestions. Second, students must refine and improve upon Copilot’s recommendations and learn to identify any incorrect suggestions. This practice enhances critical thinking and reinforces good practices. In teaching, we must balance Copilot usage with understanding documentation. Lastly, it’s vital to underscore that Copilot is an assistive aid, not a replacement for foundational coding skills.

Conclusion

GitHub Copilot has significant potential to be a transformative tool in introductory programming education. It offers a variety of functions that can significantly benefit beginners. Used strategically and under close supervision, Copilot can become an asset in a novice programmer’s toolkit. It can provide help and immediate feedback to increase comprehension and build confidence, much like a virtual tutor. However, it’s essential to recognize the delicate balance between assistance and over-reliance on AI tools. The challenges faced in integrating GitHub Copilot into programming education are reminiscent of those faced by mathematics educators when determining at what grade level a student should be allowed to use a calculator. Just as a calculator can aid in complex calculations but should not substitute for understanding basic mathematical principles, Copilot can be a valuable tool for code suggestions and error corrections but should not replace a solid understanding of programming concepts.

References

Nguyen, N., & Nadi, S. (2022). An empirical evaluation of GitHub copilot’s code suggestions. Proceedings of the 19th International Conference on Mining Software Repositories. https://doi.org/10.1145/3524842.3528470

Lau, S., & Guo, P. (2023). 16. https://doi.org/10.1145/3568813.3600138

Leave a Reply

Your email address will not be published. Required fields are marked *