Copilot vs. ChatGPT: Chatbot or AI Coding Assistant?

Copilot vs. ChatGPT: Chatbot or AI Coding Assistant?

For sure, you've seen the buzz around ChatGPT lately, which is used for everything from summarizing articles to crafting complex Excel formulas, even generating code snippets like an experienced developer.

But how does it compare to GitHub Copilot, the AI specifically designed to assist you in writing code? We will answer that today, helping you decide which AI tool will help you best in your future projects.

Let's get started ✌

GitHub Copilot vs. ChatGPT - Quick Summary

Here's a brief overview of the features and benefits of both tools before we dive into the specifics 👇

GitHub Copilot ChatGPT
Real-Time Suggestions
Chatbot Currently, no, but it will be available in Copilot X
Integration Into IDE ❌ ChatGPT does not have a built-in integration feature. But it's possible to integrate ChatGPT with certain IDEs through some workarounds
Code Explanation
Context-Aware Recommendations
Generated Code Quality Similar Similar
Price $10/month or $100/year for individuals, $19/user/month for businesses Free for GPT-3.5 or $20/month for GPT-4

GitHub Copilot vs. ChatGPT - Key Differences

Now, let's compare Copilot and ChatGPT in terms of the quality of the code they create and how easy they are to use.

Generating Code

I will test both AI assistants with the same use cases to see if there's a clear winner in terms of coding quality. I asked each tool to generate code in JavaScript, and we'll compare the results.

First, I used ChatGPT to write a function that generates a Fibonacci sequence.

Fibonacci function generated by ChatGPT
Fibonacci function generated by ChatGPT

Chatbot generated a working function and provided me with an explanation. But how is the code quality? It's okay, but it could be simplified.

We can improve the code by using either one if statement or the Array.slice method instead of having two separate conditional statements that push to the array.

Also, the array could be declared as a let instead of a const. So, despite the code working correctly, it could be refactored. Still, it's a working piece of code that AI created in seconds.

What about GitHub Copilot? I gave it the same task of creating a function that generates the Fibonacci sequence. Here is the outcome:

Fibonacci function generated by GitHub Copilot

There are some differences that we can quickly spot. First, this function uses var instead of const and let, which is a bad practice.

Also, the function in Copilot does not consider the scenario where we pass 0 or 1 as an argument. So, even if we pass 1, we will still receive an array [0, 1] as a result, which is something that ChatGPT predicted.

The code snippets generated by the two tools have some noticeable differences, and neither output is perfect, which is something we can expect when using AI. That's why it's crucial to verify the content that is created.

Refactoring Code

We have already seen two AI-powered tools write code. Now let's look at how they perform when it comes to refactoring. I asked ChatGPT and Copilot to improve the previously generated code for the Fibonacci sequence.

I used ChatGPT to make my function more concise and didn't give any additional information to see how AI would handle it. And I was impressed with the results.

ChatGPT not only got rid of unnecessary statements, but it also used Array.slice in a very clever way.

Function refactored by ChatGPT
Function refactored by ChatGPT

Copilot did a good job, too. I asked it to fix the code two times. First, I asked it to use let and const instead of var. Second, I asked it to change the function so it works when n is less than 2.

Function refactored by Copilot
Function refactored by Copilot

ChatGPT's code is better because it's more concise, but this example shows you can also improve existing code using GitHub Copilot.

Still, I find ChatGPT more useful for fixing code. It's mostly because of the chat-style interface, which makes talking to the AI easy. We can always tell it straight away if something isn't right.

Real-Time Suggestions and Context-Aware Recommendations

Here's where GitHub Copilot really stands out and shows why it's primarily built for coding. Its real-time suggestions and integration with IDE make coding a lot quicker.

AI assistants are very convenient for generating boilerplate code (sections of code that we use a lot and often repeat when programming). This makes creating things like variables, types, and basic code much easier.

Let me show you an example of how simple it is to create a type in TypeScript with Copilot.

Copilot helps with creating the Car type
Copilot creates the Car type

Sure, we can do the same thing with ChatGPT, but it will take more time. That's because we have to type a prompt in the chat box instead of just writing directly in our code editor.

ChatGPT creates the Car type
ChatGPT creates the Car type

Integration with IDE

When it comes to integration, it's very easy to add Copilot to your favorite IDE. It works with Visual Studio Code, Visual Studio, Neovim, and JetBrains.

With ChatGPT, it's a bit more complicated. We can find a workaround to get it into some editors or install it on our computer, but it's more complex than setting up Copilot.

The good news is there are AI Coding Assistants like Codeium, which offer real-time suggestions and a built-in chatbot. There's also news of GitHub Copilot X coming soon. It'll have interesting new features like a chat function and CLI integration. So, it's something to watch out for.

Which Tool Is for You?

We can use both Copilot and ChatGPT together, as they serve different purposes. Copilot excels at suggesting code in our editor, and ChatGPT at communicating with AI via a chat interface. So we don't have to choose between them.

But a good idea would be to add a chat window into your IDE for quick access to the chatbot without switching tabs. You can also use some all-in-one AI assistant that offers both chat and real-time suggestions directly within IDE.

AI coding assistants can speed up the coding process, and ChatGPT can assist with complex tasks such as refactoring code or generating entire functions. But no matter which tool you use, you should always be careful with the code it generates.

It is important to always double-check the quality of the AI-generated code.

What Is GitHub Copilot?

GitHub copilot website
Image credit: GitHub

GitHub Copilot is a programming assistant designed to help developers code more efficiently and with less effort. By leveraging OpenAI Codex, GitHub Copilot provides real-time code and function suggestions based on the context derived from comments and existing code.

GitHub Copilot offers features such as:

  • Real-time code suggestions that transform natural language prompts into working code.
  • Compatibility with numerous languages, thanks to its extensive training on billions of lines of the actual code.
  • Context-aware recommendations tailored to your project's style and patterns.
  • Two pricing plans: Copilot for Individuals ($10/month or $100/year) and Copilot for Business ($19/user/month), each with added benefits catered to their respective user bases.
  • Integration with popular editors like Neovim, JetBrains IDEs, Visual Studio, and Visual Studio Code makes it an accessible tool for developers.

What Is ChatGPT?

ChatGPT website
Image credit: OpenAI

ChatGPT is an AI-powered chatbot created by OpenAI. It uses GPT-3.5 and GPT-4 architectures to understand and respond to messages, making conversations natural.

ChatGPT is a universal AI chatbot, so coding isn't the only thing it can help us with, but it still is a powerful coding companion.

Also: Take a look at my article about using ChatGPT for coding.

ChatGPT offers coding features such as:

  • Generating and explaining code snippets for various programming concepts.
  • Discussing and explaining syntax, functions, and concepts from multiple programming languages.
  • Providing step-by-step walkthroughs of algorithms and data structures.
  • Guiding users through debugging processes and suggesting potential solutions for coding issues.
  • Suggesting improvements for code quality and style.


What Are the Best Alternatives to Copilot?

The most popular Copilot alternatives are TabNine, Amazon CodeWhipserer, and Codeium. These generative AI tools help suggest code snippets, but some have more complex features like detecting hard-to-find vulnerabilities in the code or incorporating a chatbot function within the IDE.

What Is an AI Coding Assistant?

An AI coding assistant is a tool that uses the power of machine learning and natural language processing to assist developers in writing code. Think of it as your coding companion that offers suggestions for code completion, detects syntax errors, and provides real-time debugging help.

AI coding assistants also help streamline the coding process, save time, and simplify developers' lives by automating repetitive tasks and providing code recommendations. The most popular AI coding assistants are GitHub Copilot, TabNine, Amazon Code Whisperer, and Codeium.

Wrapping Up

Remember that ChatGPT isn't just for coding - it's a universal AI that can help with many tasks. On the other hand, Copilot is specifically created for programmers.

It's all about understanding your needs and choosing the right tool to help you in your future projects.

Thanks for taking the time to read this.

Happy coding ✌

Table of Contents
Great! Next, complete checkout for full access to Kajetan Domagała.
Welcome back! You've successfully signed in.
You've successfully subscribed to Kajetan Domagała.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.