Another ChatGPT use that you probably didn’t know
If you’re a tech enthusiast, you’ve probably heard about ChatGPT and the waves it’s making across several sectors. To call ChatGPT a chatbot is an understatement. It’s better thought of as a tool that offers almost any kind of written solution in a human-type conversational environment.
Because of its enormous dataset, it’s capable of performing previously unthinkable tasks. You can ask it to write poems about chihuahua dogs and loudspeakers, develop code, write essays on remote controls, and much more.
Given its incredible flexibility, there is a lot of interest in this tool that goes far beyond customer service chatbots. The usage of this tool even includes some questionable practices.
One of the most important questions is whether these tools can mean the end of Google, at least as we know it. This is because people are using it to find fast and accurate information. It’s so powerful even Microsoft is considering incorporating it into its search engine Bing.
It seems as if the only limit of ChatGPT is the written media, so the use people can give it is wildly varied and imagination is the only barrier between solving an issue and this AI. And one of the hottest areas where a lot of experimentation is taking place is, of course, software development.
De-minify your code
One of the most recent examples of ChatGPT’s flexibility is deminifying code. For those who aren’t familiar with this, let’s explore two concepts: minifying and deminifying also called unminifying.
Minifying means reducing unnecessary characters. These not only include blank spaces, but also comments and long variable names. People do this to reduce code size, or because they’re used to certain expressions and it saves them time. The problem is, the code becomes hard for humans to read and understand.
Deminifying is the opposite. Given an arcane code, you deminify it by adding more expressive variables, comments, more lines, and a better layout so it can be understandable by anyone.
It’s easy to imagine software able to minify code, and there are many choices available. However, deminifying requires inventiveness, creativity, and other seemingly human qualities. It’s not surprising, then, that machines have a hard time when tasked with this. But again, this was the case until ChatGPT arrived at the scene.
People have been using this software to deminify code. Not only that, but it also offers explanations of what it does. For instance, I tasked it with unminifying the following code:
var array=[];for(var i=0;i<5;i++){array[i]=i;}
It gave the following answer:
var array = [];
for (var i = 0; i < 5; i++) {
array[i] = I;
}
This code creates an array called "array" and assigns it the values [0, 1, 2, 3, 4]. It does this by using a for loop that iterates 5 times and assigns the value of the loop variable "i" to the current index of the "array" variable on each iteration.
It goes without saying that this AI is not only helpful for people having issues when developing software, but it can also serve as an incredible learning experience. The most exciting thing is, this is just the beginning. New uses for AI tools are popping up every day, so tomorrow there’ll probably be yet another way in which ChatGPT makes our lives easier.
Advertisement
That example is pretty printing, not unminifying. GitHub CoPilot does proper unminification if you give it enough context (renaming methods and properties from _e to getCookieValue and such), but without context there is not much to be gained here.