Do you routinely spend hours crawling through Google sites and StackOverflow to find answers to your technical queries and solutions to bugs?
That’s the old way. Now, you can have a natural conversation with ChatGPT, right there from a simple interface that guides you through any coding challenge you might face.
Not only will the AI suggest solutions to coding challenges and prompts, it will explain the code, how it’s structured, or its flaws in any level detail you ask it to.
StackOverflow recently banned ChatGPT-based responses from its site, as the AI was used to ‘game the system’, in an attempt by some users to boost their credibility score by simply copy-pasting pre-made answers to coding-related queries. If anything, this is proof the AI can be useful enough to solve real-world, complex programming tasks. Let’s dig in.
Inside ChatGPT, you can ask the AI to…
Produce new code based on your prompt
Simply type in a prompt with instructions in natural language, describing what you want to achieve. The AI will follow your exact instructions, so the more detailed you are in the prompt, the better the outcome will meet your needs.
Here, I simply ask the AI to spin up code for a stock screening web app, splitting out the front and back end part of the code.
And, lo and behold, it did just that.
Front…
…To back.
ChatGPT will know what API to connect to in order to achieve the desired functionality, and adds clear comments and placeholders throughout the code to make it clear what each part of it is for.
You can ask ChatGPT to explain any part of the code, functions, libraries, and so on. You can also expand on the code, asking the AI to build in new parameters within any function of, in this case, the web app you’re building.
For example, I asked the AI to rewrite the above code by utilizing Yahoo Finance’s API, which it immediately did. Below the code block, ChatGPT explained:
“This code makes an API call to the Yahoo Finance API using the
requests
library to retrieve stock data for a list of symbols (in this case, Apple, Google, and Microsoft). The stock data is then filtered based on the specified criteria and passed to the template to be displayed in the table.You will need to sign up for an API key from Yahoo Finance in order to use the API. You can find more information on how to do this and how to use the API in the Yahoo Finance API documentation.”
Help you debug code
The other use case for ChatGPT is to feed it existing code that contains errors or doesn’t behave as expected, and ask it to fix it, or suggest improvements.
This works on both new code you feed the AI, as well as the code it itself suggested in previous responses. That’s right, if the ChatGPT-generated code doesn’t work or creates an error when you run it, you can share the error message you’re getting and the AI will explain what the error message means, plus suggest corrections on the back of its own code. Pretty slick, isn’t it?
For instance, when I ran the above code in VS Code on my machine and tried accessing my local server, I got an error. ChatGPT explained the potential root causes for this error and where to look to fix it.
The AI is able able to spell out any dependencies such as new libraries you might need to install on your machine, depending on the error you’re getting when running the code.
Since ChatGPT has a vast knowledge of all the above, it can explain any coding concept so you can accelerate your learning of any aspect of programming.
Want to get up to speed on Flask servers, a particular API, a specific function or front-end library? ChatGPT got you covered.
You can also ask it to simplify a complex concept (“Explain X to a 5-year old” is a good prompt for this), or on the other hand, to go into more depth.
Now, here’s a fun one. Turns out you can ask ChatGPT to simulate a Linux terminal and even deploy a virtual machine within itself…Getting a little meta here!
As long as the instruction is detailed enough, you get exactly what you ask for with ChatGPT. However, as with any emerging technology, there are some limitations.
Simply put, ChatGPT cannot do everything with complete accuracy every time. Yet, it will sound 100% confident 100% of the time!
At this stage, it’s more of a helpful programming assistant. You can think of it like pair programming, given you another brain to augment your own coding capabilities, helping you resolve issues faster, build boilerplate templates and simple use cases in half the time (or less!).
However, if you’re providing, say, freelance website development services focused on building basic website templates, things could go one of two ways. You could 10X your output and be able to take on many more clients, churning out the same amount of work in much less time.
Or, clients might catch on and directly self-service the code they need from a solution like ChatGPT or simply put pressure down on prices because they are aware of ChatGPT and how it impacts the development workflow.
In this case, you might want to adjust your offering, providing more advanced services for instance. Time will tell!
Whilst existing AI-led coding solutions such as Repl.it Ghostwriter or GitHub Copilot (built on top of OpenAI’s GPT-3) are impressive as they are, ChatGPT provides a conversational interface to level up your coding skills, automate menial tasks, and accelerate your output.
Rather than simply explaining code like other AI coding solutions do, it’s able to take in any prompts and provide recommendations, adjusted to the level of detail you provide it, and then keep building and improving upon those suggestions.
So, as a developer, you can use ChatGPT to be more efficient and focus on the complex, higher-value tasks.
It won’t replace you entirely (at least for now), instead it can make you a much more productive coder. With ChatGPT, create, improve, debug and learn code faster.