DEV Community

Cover image for 5 uses of ChatGPT for programmers
Yamilka Henriquez Cosme
Yamilka Henriquez Cosme

Posted on • Updated on

5 uses of ChatGPT for programmers

By Yamilka Cosme

Do you prefer to read this article in Spanish? Here is the article in its Spanish version, chatgptSpanish

In recent months, we have had a bombardment of new artificial intelligence (AI) tools, which can do everything we ask of them. One of these tools is ChatGPT, which is an artificial language model designed to process and generate natural language in a way similar to how a human does. It is capable of learning from large amounts of data and generating responses to questions or texts autonomously, making it useful in a variety of applications, such as chatbots, virtual assistants, and recommendation systems.

Panic gif

Panic is what everyone felt when they started using these tools, and they returned working code. But, we had seen this before, remember GitHub Copilot? The same thing happened when it was released, and we are all still here. Yes, when GitHub Copilot came out, many programmers used it in their day-to-day work, and that is what we should do with ChatGPT as well.

Next, I will give you 5 use cases of ChatGPT in the daily life of a programmer. And if you know more ways to use it, I invite you to write in the comments, 'In what cases have you used it?', and we can all learn. So let's get started.

1- Website translation

If you have ever worked with website translations using Reacti18n, you know that this can be a headache. When translating a website, you need to have an object (key:value), where the value should be all the texts in a language X, then you must create another object that is identical, but the values should be in language Y. This is better expressed with the following example:

{
title: "Welcome to my company",
text1: "Home", 
text2: "Services", 
text3: "Our"
}
Enter fullscreen mode Exit fullscreen mode
{
title: "Bienvenido a  mi compañia",
text1: "Inicio", 
text2: "Servicios", 
text3: "Nosotros"
}
Enter fullscreen mode Exit fullscreen mode

In the real world, the object will not be so small, it could easily have hundreds of lines that would need to be translated into the required languages on the website. But with ChatGPT, this is as easy as telling it,

Take this object and keep the keys as they are, and translate all the values to language X.

And that's it, you can have the translation object in the languages you want.

2- Creation of specific functions

In programming, there is this concept of (utils/helpers) that are pieces of code that perform a specific function and that we can call wherever necessary in our program. An example of this would be a function that formats a number for you or returns the ISO of a currency. We can easily do this with ChatGPT, using the right words to return a well-made function (in most cases).

3- Test creation

Just as you describe the step-by-step process for your tests, you can also tell ChatGPT step-by-step what you want it to do and tell it what test technology you want to use. An example of this is the following:

Give me a test written in Cypress where you do the following: First, you go to the website and fill out the form with the email and password fields. Then you click the submit button. Finally, you search for a text that says "successful login".

4- Generate HTML/CSS template

From creating a card to a menu, ChatGPT can create elements in HTML and CSS for you. If you want to add CSS styles, you need to be as specific as possible so that the result is as close as possible to what you want. But where ChatGPT really shines is in generating email templates.

5- Resolution of specific questions

In our daily life as programmers, we always come across different libraries, technologies, and ways of doing things. In these cases, we add new knowledge to what we already had, and we can become confused. We were using Context for data globalization, but now we use Redux, and then we moved to Zustand. What is the difference between all these technologies? When should I use one or the other? These are common questions that we ask ourselves, and ChatGPT can explain them to us as we want and as many times as we want, even with examples and all.

Did you like my post? 🤗 If so, react with ❤️ and comment below.

YamiYami says bye bye. 👋

Top comments (0)