Home » Developer Relations » Is AI the Ideal Programming Partner?

Developer Relations Is AI the Ideal Programming Partner?

Author Photo

Devon McClure

September 6, 2023

Pair programming is a method in which developers work side-by-side while coding. One, the “driver,” writes the code, while the other, the “navigator” reviews the code in progress. This method tends to improve the quality of code. It also provides an avenue to talk through potential roadblocks, and distribute knowledge among developers. A recent uptick in AI-powered pair programming tools, such as GitHub Copilot and Codeium, presents the opportunity of reaping the benefits of traditional pair programming, while maintaining efficiency given that developers aren’t paired with one another but with AI. Despite its ability to increase efficiency, AI pair programming tools aren’t an adequate substitute for traditional human-human pair programming. AI pair programming, however, can be a valuable tool for the experienced developer, while traditional pair programming appeals to the novice.

How does AI Pair Programming Work?

Integrated development environments (IDEs), such as Visual Studio, provide autofill suggestions that aren’t in-depth but rather attempt to match what a user is typing with a list of known phrases for a given programming language. This is comparable to autofill for Google search. AI-powered tools, such as GitHub Copilot, take this a step further and provide detailed coding suggestions directly within the editor. These AI-powered tools receive their information from public code repositories. This large body of data allows it to reasonably predict what comes next within a function. Users then can reject suggestions or accept them and create any necessary modifications.

A comparable tool, Codeium, has functionality that allows users to write a comment explaining what the function to follow will do. And it provides suggestions for how to accomplish this. For example, a Python programmer can denote a comment with “#” and write “sends end users a confirmation email.” Codeium will then recommend how to start this function and continue to give suggestions as the user types.

Codeium has an enterprise option for businesses to train a custom AI model on their code repository. The objective is to increase the relevance and accuracy of suggestions. But it comes with security concerns.

Benefits of AI Pair Programming

AI pair programming tools are best suited for simpler programming tasks completed by experienced developers. That way, the developer can work even more efficiently and spot and correct mistakes the tool suggests. Inexperienced developers, however, may take longer to correct mistakes or may even produce harmful code unknowingly. Or they might not understand the specific coding approach the AI suggests, making it difficult to integrate within a project. Alternatively, junior developers may use ChatGPT for code inspiration and to ask follow-up questions if parts are unclear. For any experience level, AI pair programming tools can provide inspiration and give procrastinators a place to start on their projects.

It may, however, take more time to correct the AI’s approach than it would have taken to write the code from scratch. A research study found that more lines of code were deleted in the subsequent sessions when that code was written by AI, as compared to when a programmer wrote without any assistance.

The Appeal of Traditional Pair Programming

Traditional pair programming has been shown to increase developer satisfaction and improve communication skills. Instead of rubber duck debugging, in which developers explain bugs to rubber ducks in order to work through fixing them, developers can receive feedback from one another and expose themselves to different viewpoints. Hearing a conflicting perspective increases the quality of solutions. In fact, pair programmers create code with fewer defects than solo programmers. An experiment found that 3% of lines contained a bug when the code was produced by a programming pair, while this value was 6% for solo programmers.

Programmers also complete their tasks more quickly when working together as compared to working alone. In fact, one study found that pair programmers, on average, require 29% less time than an individual programmer. 

Traditional pair programming doesn’t suit everyone, however. Some developers prefer to work alone, or misalignment of experience levels in a pair can lead to disengagement or frustration.

The Verdict

No programming approach is without flaws. AI pair programming prominently lacks the benefits of human-human collaboration, and the quality of suggestions is hit or miss. Conversely, traditional pair programming forces developers to sacrifice efficiency in hopes of producing higher quality code. 

Ultimately, it should be up to the individual developer to experiment with pair programming techniques. The developer can then determine what works best for them. This may come in the form of traditional human-human pair programming, AI pair programming, solo programming, or some combination of these. The best approach depends on the developer’s experience, programming partners available to them, and the project’s complexity.

Archives

Categories