ChatGPT vs GitHub Copilot

ChatGPT and GitHub Copilot are the most popular AI writing tools known today. While both of them have the power to help us with writing efficiently, they have different abilities and are designed (almost) for various purposes.

We'll take a deep dive into the features, abilities, and use cases of each of them to better understand when to use ChatGPT and when to use GitHub Copilot.

So, let's begin!

What is ChatGPT

ChatGPT is a powerful language generation model developed by OpenAI. It's been trained on a vast quantity of internet text and is competent in creating text that resembles human writing.

Its capabilities are not restricted to just generating text but it's also adjusted for various natural language processing tasks such as language translation, answering questions, summarizing text, suggesting code parts, and others.

Many users use ChatGPT to improve SEO rankings it can generate catchy titles, descriptions, and even article outlines. Even though it does a good job, it should be used with care in mind.

See how ChatGPT managed to write a technical article!

ChatGPT chat

How ChatGPT works

As its name says, ChatGPT is a chat, you can have a dialog on various subjects, and when given a prompt, it generates text that continues the dialog.

You can ask for anything, in my case I tested it many times by providing me code examples, such as generating unit tests for a class, ready solutions for some functions (just for test), and other programming things.

Keep in mind its model is based on events that happened until 2021, and it can't say anything about what happened after 2021 (for now).

ChatGPT works better if you give him more detailed instructions, but to keep them always writing is a waste of time, that's many users across the internet came up with a collection of ready-to-use prompts on a vast area of usage.

Use cases for ChatGPT

ChatGPT can be used for various tasks such as text generation, language translation, question answering, and more.

Some specific examples include:

  • Text summarization - ChatGPT is trained to summarize long documents or articles into a shorter version.
  • Language Translation - ChatGPT can translate text from one language to another with high accuracy.
  • Chatbot - It can be integrated into a chatbot to generate human-like responses to user queries.
  • Writing code - Even though it's not always accurate, it can still write good code examples, based on the prompt it was given.

GitHub Copilot: The Future of Code Writing

GitHub Copilot is a code completion tool that uses AI to suggest lines of code while you're writing.

GitHub Copilot

How GitHub Copilot works:

GitHub Copilot uses machine learning to understand the context of your code and suggests lines of code to complete your code.

It excels when used from the beginning of a project, as it can generate functions, variable names, and algorithms that align with your programming style. However, using it in the middle of a project may result in suggestions that require significant rewriting of existing code.

Copilot can learn from the code that you write and get better over time.

Benefits of using Copilot:

Using Copilot can help to improve your code writing efficiency and reduce the time spent on coding.

Some specific benefits include:

  • Autocomplete code suggestions - Copilot suggests lines of code that you can use to complete your code.
  • Intelligent variable and function suggestions - Copilot suggests variable and function names that are relevant to the context of your code.

ChatGPT or Github Copilot?

Before we get into details, let's see how they manage with creating some code.

I told ChatGPT to create a function in javascript that gets a date and timezone inputs and returns a date in the timezone sent.

By default, the timezone is America/Los_Angeles.

Here's what I got:

function convertDateTime(date, timezone = "America/Los_Angeles") {
  let dateObject = new Date(date);
  let dateTimezone = dateObject.toLocaleString("en-US", {timeZone: timezone});
  return new Date(dateTimezone);

console.log(convertDateTime("2022-12-25", "Asia/Tokyo")); 
// Output: "Mon Dec 26 2022 00:00:00 GMT+0900 (Japan Standard Time)"
// Output: "Sun Dec 25 2022 00:00:00 GMT-0800 (Pacific Standard Time)"
A function generated by ChatGPT

Not bad!

Now let's see how GitHub Copilot is managing it. I created a comment and put the same query.

Here's what Copilot generated for me:

// Create a function in javascript that gets a date and timezone inputs 
// and returns a date in the timezone sent. 
// By default, the timezone is America/Los_Angeles.
function convertDate(date, timezone = 'America/Los_Angeles') {
  return new Date(date.toLocaleString('en-US', { timeZone: timezone }));
Function created by Github Copilot

Not bad at all!

Copilot has created a much shorter code in this case, while ChatGPT has a more descriptive one, but both of them have done a pretty good job.

What do I choose? I choose Copilot for coding, as it is entirely integrated into my IDE and helps me code much faster than before. It is also good at writing code documentation and unit tests.

GitHub Copilot is designed to help developers to write code faster and more efficiently. Is just for coding!

On the other hand, ChatGPT serves as an AI assistant, providing optimized solutions and suggestions for refactoring code. It can also guide specific language features, and the use cases for anonymous functions, to ensure safety and security in your project.

While GitHub Copilot is entirely focused on code, ChatGPT has various abilities in different areas, such as SEO optimization, writing poems, and ebooks, giving good ideas on blog articles, writing article outlines, and everything related to writing.

AI-powered writing tools like ChatGPT and GitHub Copilot have the potential to revolutionize the way we write and improve our efficiency. Every day I use Copilot and it keeps imprese me.

Let me know what you think about these tools, and if we should be worried they can replace our jobs?!