Benjamin Semah | 08 Aug, 2023

Why Coders Are Turning to ChatGPT as Their Go-To AI Assistant

As programmers, we always look for new ways to make our work more efficient. And we love the tools that help us achieve faster results. ChatGPT is one such tool that’s rapidly rising in popularity. In less than three months, ChatGPT has reached over 100 million users.

ChatGPT is an AI chatbot capable of providing text-based answers to questions. 

In this article, we will provide a comprehensive guide on how to use ChatGPT effectively as a programmer, some tips and tricks to get the most out of it, and its limitations to keep in mind.

What Exactly Is ChatGPT?

ChatGPT is a machine learning model developed by OpenAI. The model was trained on large amounts of text data using unsupervised learning. This means the model isn’t explicitly taught what to do but learns from data patterns.

As a result, it can provide answers to a wide range of questions. You can interact with ChatGPT using a chat interface, and it can give you text-based answers to your questions. And the good thing is you don’t even have to be a programmer to use it. If you can ask questions, you can use ChatGPT.

How Can I Use ChatGPT?

To use ChatGPT, visit the official website and create an account. After signing up and logging in, you will see an interface with a text box below. Type in your question, and ChatGPT will provide you with an answer.

What Can ChatGPT Do For You?

As a programmer, ChatGPT can be a valuable tool to help you work better and faster. Here are some ways to improve your coding workflow using ChatGPT.

1. Add Comments to Your Code

Adding comments to your code is crucial because it can make it more readable and understandable, especially for other developers that need to work with it now and in the future.

ChatGPT can generate comments for your code automatically. You only need to provide the code to ChatGPT and ask it to create comments. It will then analyze the code and add comments to describe what it does and how it works.

This can be really useful if you’re working with a large codebase and need to add comments for many functions and methods quickly. 

Here’s an example from when I asked ChatGPT to generate comments for some JavaScript code I wrote.

Asking ChatGPT to Auto-Generate Comments for Code

Asking ChatGPT to Auto-Generate Comments for Code

ChatGPT’s Auto-Generated Comments for My Code - Impressive!

2. Convert Code From One Language to Another

You will often come across code in a language you’re unfamiliar with, especially with tutorials or projects from other developers. ChatGPT can help here, as it translates code from one programming language to another. For example, I asked ChatGPT to convert my code from JavaScript to Python, and it did this with ease.

ChatGPT Converted My Code from JavaScript to Python

3. Help You Prepare for Technical Interviews

ChatGPT helps you prepare for technical interviews. To do this, just ask it to take the role of an interview. That’s right; it will act like the hiring manager!

With this, it’s essential to provide context to get relevant questions. For example, suppose you’re a front-end developer with an upcoming interview for an entry-level position. Here’s how you can use ChatGPT to prepare.

Asking ChatGPT to Ask Me Some Interview Questions 

In this case, you can try answering the questions yourself, but if you don’t understand one, you can also ask for an explanation.

For example, if you don’t know the answer to question five, you can use a prompt like the one in the screenshot below. It then provides a detailed explanation of the question, including an appropriate answer.

Asking ChatGPT to Explain a Question I Don’t Know The Answer To

Note: If you want to know the top interview questions and answers for your next technical interview, check out our long list of Interview Questions articles.

4. Write Tests for Your Code

Testing is an important part of software development, but writing tests can be time-consuming. With ChatGPT, you can quickly generate test cases for your code. Let’s see an example.

The following is a JavaScript function that converts Snake Case to Camel Case.

function snakeToCamel(str) {

  const words = str.split(/[_-]/);

  const capitalizedWords =, i) => {
    if (i === 0) {
      return word;
    } else {
      return word.charAt(0).toUpperCase() + word.slice(1);

  return capitalizedWords.join('');

I gave this code to ChatGPT and asked it to write tests for the function, as shown below. I even specified my preferred testing library (Cypress) and the number of test cases.

Asking ChatGPT to Write Test Cases for My Javascript Function

5. Generate Dummy Data

There are many reasons why you might need to use dummy data, whether for prototyping when you don’t have access to real data, for privacy concerns, or training and education purposes. Whatever your reason, ChatGPT can generate dummy data easily and quickly.

For example, as shown below, I asked ChatGPT to generate dummy SQL data for five merchants, including id, name, email, and location.

Asking ChatGPT to Generate SQL Dummy Data

6. Refactoring Your Code

Refactoring code might involve checking and applying best practices, using an alternative that’s more efficient, optimizing for performance, and more. Once again, ChatGPT can help here by analyzing your code and offering suggestions on improving it.

In this example, I asked ChatGPT to refactor the following JavaScript function to calculate the sum of all numbers in an array. It then returned a different method for solving the same problem, and it even explained why it was better than the original.

Asking ChatGPT to Refactor My Javascript Code

ChatGPT’s Optimized Version of My JavaScript Code

7. Debugging Errors in Code

Sometimes, little things like typos, punctuation, etc., can introduce annoying and time-consuming errors. Fortunately, ChatGPT can help you quickly debug and fix errors in your code. For example, the following code throws an Uncaught RefenceError.

JavaScript Code With an Intentional Error

So, I asked ChatGPT to tell me what was wrong with the code. Not only did it tell me what was wrong, it gave hints about how to solve it and provided a solution.

ChatGPT Explained What Was Wrong With My Code, Then Fixed It for Me!

8. Use ChatGPT as a Research Assistant

As a programmer, you may need to research the best solution to a problem. Rather than the standard Google search, forum trawl, and doc reading session, just ask ChatGPT some technical questions or explore different approaches to solving a problem.

In this example, I’ve assumed that you’re learning to code, but you’re a little stuck on the concept of variables. No problem, just ask ChatGPT to explain variables to you like it would to a 10-year-old! The result is an easily digestible explanation.

ChatGPT Explaining the Concept of Variables to Me as if I Was a 10-Year-Old

9. Brainstorm New Ideas for Your Projects.

You can ask ChatGPT for new ideas for coding projects or features to add to existing projects. 

For example, if you have a landing page for your new startup, you can ask ChatGPT to propose new features to add to it. And as shown below, this is a great way to generate valuable ideas you may not have thought of.

Asking ChatGPT to Suggest New Features for My Landing Page

How to Get Better Answers From ChatGPT

There’s no doubt that ChatGPT is a powerful tool for generating informative answers to a wide range of questions. But getting the best responses from ChatGPT requires specific strategies. Let’s look at some tips for getting better answers from ChatGPT.

  • Be specific: Ask clear and direct questions. The more specific your question to ChatGPT, the better your chances of a helpful response. For example, instead of asking, “How do I write better code?” you could ask, “What are some best practices for improving code readability in JavaScript”.
  • Ask follow-up questions: If you’re unsatisfied with the response, ask follow-up questions to clarify or get more information. This will help ChatGTP refine its response and provide more accurate information.
  • Provide context: Give ChatGPT relevant information that it can use to understand the context of your question, as shown in the two examples below:
    • Not good: “What is wrong with my code?”
    • Good: “I’m building a React component and getting TypeError when I try to render it. Here’s the code. Can you help me understand what’s causing the error? ”

What Are the Limitations of ChatGPT?

While ChatGPT is an incredibly powerful language model, it’s not a perfect tool. There are some fundamental limitations to remember when using ChatGPT.

  1. Limited knowledge base: Although ChatGPT has been trained on a massive amount of data, there are limits on the topics it can effectively handle, including specialized or technical topics that may be beyond its scope.
  2. Lack of contextual awareness: ChatGPT can generate grammatically correct responses, but it may not understand the broader context of a conversation. This can result in responses that don't fully answer a question or don't take into account nuances or details.
  3. Biased responses: Like any machine learning model, ChatGPT shows biases towards certain responses based on the data it has been trained on. While efforts have been made to minimize bias in ChatGPT, it's important to be aware of this limitation when using it.
  4. Lack of emotional intelligence: ChatGPT doesn't have the emotional intelligence that a human might bring to a conversation. This means it can sometimes give technically accurate responses but lack the empathy or understanding that a human might provide.
  5. Security concerns: ChatGPT may not always provide secure solutions, so you must exercise caution on providing any sensitive information to ChatGPT. You should also ensure that any suggestions or solutions provided by ChatGPT do not compromise security.

ChatGPT Masterclass: A Complete ChatGPT Guide for Beginners!


ChatGPT is a powerful tool that programmers can use for various tasks, including adding comments to code, debugging errors, conducting research, and more. When used effectively, there’s no doubt that ChatGPT can help you improve your programming skills and workflow.

With over 100 million users and still counting, it’s safe to say that ChatGPT is here to stay. Ignore it at your own risk, or take advantage of it and boost your productivity in both your professional and personal life. But remember, to get the most out of this revolutionary tool, you need to factor in its limitations.

Does AI fascinate you? Explore the practical applications of AI through this Oxford Artificial Intelligence Program. Download the prospectus here. 

By Benjamin Semah

Benjamin is a software developer and technical writer for He is adept at working with the JavaScript MERN stack (MongoDB, Express, React, Node.js), as well as with TypeScript, Ruby, and Rails. As a self-taught developer, he loves learning about new technologies and sharing what he learns through writing. His writings have been featured on platforms like freeCodeCamp and Scrimba.

View all post by the author

Subscribe to our Newsletter for Articles, News, & Jobs.

I accept the Terms and Conditions.

Disclosure: is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.

In this article

Learn More

Please login to leave comments