This text was created from my defense presentation of my Master’s thesis, given at the University of Victoria, 23 August 2022. The thesis titled “AI Supported Software Development: Moving Beyond Code Completion” is available here.

full text: AI-Supported Software Development: From Copilot to Pilot

Introduction

The rise of AI-supported programming tools like GitHub’s Copilot marks a significant step in software development. Leveraging OpenAI’s Codex, Copilot assists developers by predicting and suggesting code snippets based on context. This tool represents a broader trend towards AI systems that can enhance software development productivity. However, the journey from AI-supported code completion to AI-driven software engineering involves overcoming several limitations. This blog post summarizes a research paper that investigates these limitations and proposes a taxonomy for understanding the boundaries and potential of AI-supported code completion tools.

Background

Copilot is a pioneering AI tool integrated within IDEs to suggest code based on a few lines of comments or code. It uses a large language model trained on vast amounts of code from public repositories. While Copilot excels at understanding context and semantics, software development requires more than just coding. It involves following best practices, avoiding code smells, and making rational design decisions.

Study Design

The research explored Copilot’s ability to follow language idioms and avoid code smells. Two main research questions were addressed:

  1. RQ-1: What are the current boundaries of AI-supported code completion tools?
    • RQ-1.1: How do AI-supported code completion tools manage programming idioms?
    • RQ-1.2: How do AI-supported code completion tools manage to suggest non-smelly code?

To answer these questions, the study focused on Python idioms and JavaScript best practices. The evaluation involved testing Copilot’s suggestions against established coding standards and best practices.

Results

The findings revealed significant limitations in Copilot’s ability to follow idioms and avoid code smells:

  1. Pythonic Idioms: Out of 25 tested idioms, Copilot suggested the idiomatic approach as the top suggestion in only 2 instances. In 8 cases, the idiomatic way appeared within the top 10 suggestions, but in the majority of cases (15 out of 25), the idiomatic approach was absent.
  2. JavaScript Code Smells: Copilot suggested the best practice as the top suggestion in only 3 out of 25 instances. In 5 cases, the best practice was among the top 10 suggestions, but in 17 scenarios, it was not present at all.

These results indicate that current AI-supported code completion tools are not yet capable of consistently suggesting idiomatic or best-practice code, even though these practices are widely used in public repositories.

Taxonomy of Software Abstractions

The study proposes a taxonomy to understand the capabilities and limitations of AI-supported code completion tools. This taxonomy includes six levels of software abstractions:

  1. Syntax Level: Ensuring suggested code is syntactically correct without compilation errors.
  2. Correctness Level: Providing solutions that are not necessarily optimal but solve the given programming task.
  3. Paradigms and Idioms Level: Using common paradigms and language idioms in code suggestions.
  4. Code Smells Level: Avoiding common code smells and suggesting the most optimized version of the code.
  5. Design Level: Supporting module-level and system-level design choices, including test cases, continuous integration, and adherence to coding style guidelines.

Discussion

The transition from code completion to AI-supported software engineering is challenging. Gathering sufficient training data, updating models to reflect evolving coding practices, and enabling multi-file input are crucial steps. Current AI tools like Copilot perform well at lower levels of abstraction but struggle with higher-level design tasks. Effective AI-supported code completion tools have the potential to significantly increase software development productivity, but achieving this requires overcoming these challenges. Enhancing training data quality by including verified sources and filtering out known flaws, integrating code review tools to improve suggestion quality, and adopting active learning approaches to learn a user’s context are some ways to improve these tools.

Implications

For Practitioners:

  • Pre-training the LLM: Enhancing training data quality by including verified sources and filtering out known flaws.
  • Code Completion Time: Integrating code review tools to improve suggestion quality and adopting active learning approaches to learn a user’s context.

For Researchers:

  • Moving Beyond Tokens: Developing models that work at the code block or file level, leveraging recent advances like the chain of thought process.
  • Design Patterns and Architectural Tactics: Training models to understand and suggest appropriate design choices.

Developing models that understand and suggest appropriate design choices, including design patterns and architectural tactics, is essential. AI-supported programming tools like Copilot represent a promising step towards more productive and efficient software development. However, significant challenges remain in moving beyond code completion to AI-supported software engineering. Addressing these challenges requires further research, better training data, and advancements in AI capabilities. The vision of AI-driven software engineering, where AI assists in complex design tasks, is achievable but requires continued innovation and development.

Conclusion

AI-supported programming tools like Copilot represent a promising step towards more productive and efficient software development. However, significant challenges remain in moving beyond code completion to AI-supported software engineering. Addressing these challenges requires further research, better training data, and advancements in AI capabilities. The vision of AI-driven software engineering, where AI assists in complex design tasks, is achievable but requires continued innovation and development.