Coding With GitHub Copilot

by

Approximately 70-95% of software developers have begun incorporating artificial intelligence (AI) into their workflows, according to recent surveys by GitHub and Stack Overflow. AI-powered tools have the power to help make the development process more efficient and enjoyable for software engineers, especially once they can fully incorporate the tools into their workflows. 

GitHub Copilot has gained a large following in the software world – pretty much everyone who has dabbled in AI coding has at least heard of it, and most have even tried it out. In this blog post, I’ll look at what Copilot is, how we have started using it at Grio, and how I see it shaping the future of software development. 

What is Copilot? 

Copilot is an AI-powered coding assistant that, according to GitHub, “provides contextualized assistance throughout the software development lifecycle, from code completions and chat assistance in the IDE to code explanations and answers to docs in GitHub and more.” Copilot is available for most major editors and is natively built into GitHub, making it a versatile tool for developers. 

GitHub reports that developers who use Copilot report up to 75% higher satisfaction with their jobs and a 55% increase in productivity. While I was unable to find the source of these numbers, after using Copilot, I cannot say I would question them.

Unique Features of Copilot 

Copilot has a few unique features that separate it from other AI-powered coding assistants. Some of the most notable include: 

  1. Model Selection: While many AI assistants are tied to a specific AI model, Copilot allows users to choose between Anthropic Claude or several Open AI GPT models. This is especially beneficial when completing unique niche projects, as certain models are superior for certain tasks. For example, at the time of this article, Claude has a strong reputation for coding assistance.  
  2. Slash Commands: When using Copilot’s chat feature, you can use slash command shortcuts to save time typing and make your prompts more clear. 
  3. Chat Participants: Other than prompt engineering, context is probably one of the most important concepts when working with these large language models. To optimize Copilot’s contextualization, Copilot allows you to use @ commands that focus Copilot on specific fields. This ensures that it is using the correct context when responding to prompts and questions. 

Your Copilot Coworker

Before we look at what Copilot can do (and trust me, it’s a lot), it’s important to understand its role in the process. 

I like to describe Copilot as a new employee at your company. They seem pretty smart, but you’re not always sure whether they know what they’re talking about or if they’re just talking a big game. So, it’s important to not trust them implicitly. Instead, you should be the gatekeeper between them and your codebase, just like you would be with an untested member of your team.  

Like any member of your team, new or old, Copilot makes mistakes. So it’s important to always check its work, ask clarifying questions if you don’t understand its process, and thoroughly vet its solutions before introducing them to your project. 

As a rule of thumb, a successful Copilot workflow is:

  1. Generate code with Copilot
  2. Review the code
  3. Accept or reject the code
  4. Repeat

What Can Copilot Help You Do?  

The short answer is that Copilot can help you with pretty much any development task you want to complete. Two of the tasks it’s especially helpful for include: 

  • Documentation: Documentation used to be the thing that you completed if you had the time at the end of the project. A time-consuming headache for most developers, documentation was frequently overlooked in favor of more pressing tasks. However, with Copilot, you can create relatively good documentation in a matter of minutes. If you have an app you’ve been working on for a while, simply go to a page with a lot of core functionality and ask Copilot to write you a “Read Me.” You’ll be shocked at how well it works. 
  • Testing: If I build an app in Ruby or Rails and then ask Copilot to draft my tests, it almost always writes as many or more tests than I would have written because it trains off of my data. Though the tests are never perfect, they tend to be well-formatted and adhere to the RuboCop rules in your codebase. Even with time allotted for edits and tweaks, what used to take half a day to complete can now be finalized in less than an hour. 

I have also found that Copilot is exceptionally helpful when it comes to: 

  • Explaining other peoples’ code to me
  • Writing simple components
  • Working through difficult problems
  • Getting context or help with a new language or framework. 

Where to Draw Boundaries with Your Copilot Coworker  

Like any tool, there are certain times when your Copilot should be closely monitored or sidelined completely. Some of these include: 

  1. Writing Code: Yes, you can use Copilot to help you write code. No, you should not let it write all of your code and submit it without checking its work. Copilot is great at drafting code, but it’s certainly not flawless. As I mentioned above, it’s important that you serve as the moderator between Copilot’s suggestions and your final codebase. 
  2. Asking Non-Code Questions: Copilot was created specifically for software development, so it is not knowledgeable about unrelated topics. If you have a question that is not software-related, ask a general language model, such as ChatGPT. 
  3. Using Personally Identifiable Information (PII): While the security and privacy of large language models is reportedly improving, it still has a long way to go. If you use Copilot in a terminal context, make sure you’re not logging account numbers and personal information. 

The Future of Copilot

Whenever new tools are introduced, our immediate response tends to be skepticism: What is this? Why do I need it? Will I even like using it? Yet, as the merits of the tools are slowly understood, they begin to be lightly adopted and even celebrated for the improvements they bring. Then, all too quickly, we can no longer imagine working without them.

Over the course of my career as a software developer, this trend has been repeated with countless tools, such as linters (e.g. ESLint and RuboCop), autocompleters, and code formatters (e.g. Prettier). 

Just as these software development tools have become ubiquitous for software developers, I imagine AI-powered tools like Copilot will quickly become an industry standard.

At Grio, we are incorporating AI-powered tools like Copilot into our design and development processes. If you’re curious about how we can use these tools to help you create an innovative app, contact Grio for a free MVP consultation. 

Leave a Reply

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