Can Generative AI Teach You to Code? It's Complicated

Can Generative AI Teach You to Code? It’s Complicated

03/08/2023
8 minutes

The ChatGPT hype is reaching a fever pitch: Educators are figuring out how to manage the AI chatbot in classrooms; programmers are using ChatGPT to write and debug code; job seekers are farming out their cover letters to ChatGPT, and hoping recruiters can’t tell the difference (they can). And tech giants are betting billions of dollars on the technology. 

If you haven’t heard of ChatGPT before, it’s a free AI chatbot created by the research company OpenAI, that’s trained to interact with humans in a conversational way. Ask it, for example, How do I make an HTTP request in Javascript? ChatGPT will instantly oblige, providing not just an explanation, but multiple examples of code snippets that you can copy and paste. As generative AI tools like ChatGPT catch on, workers across all professions are reckoning with the possibility of obsolescence and growing curious about the types of opportunities this technology could create. 

So what does ChatGPT mean for people whose jobs involve coding, or the folks who are learning to code because they want to have a technical career? Ahead we’ll explore how ChatGPT can help you learn to code, why it’s not a direct replacement for software engineers, and the AI and machine learning skills you should learn about now.

What is ChatGPT and how does it work?

ChatGPT is an AI chatbot that’s powered by a type of deep learning model that generates human-like text. On a very basic level, the large language models are trained to predict the word that’s likely to come next in text using probability distributions over words. This technology is an example of a neural network, which is a programming model inspired by the human brain. ChatGPT fits under the umbrella of “generative AI,” which is any AI that creates content, like the image-generator DALL-E, for example.

The GPT in ChatGPT stands for “Generative Pre-trained Transformer,” because the AI is pre-trained with data from the internet — and that’s key to its uncanny human-like responses. “They’re trained on these massive data sets from the internet, which is how they get such a finely-tuned sense that they can respond to these sort of absurd prompts, like, Rewrite some song in the style of Shakespeare,” says Ada Morse, Codecademy Curriculum Developer in Data Science. 

Learn something new for free

ChatGPT is the successor to GPT-3, a language prediction model that was released by the AI research company OpenAI in 2020. The reason why ChatGPT has been getting so much hype is because it’s the best AI chatbot that the general public has experienced. (It’s also currently free to use.)

Beyond individuals who are having fun playing around with the AI chatbot, major tech organizations are finding ways to get in on the action. Microsoft, for example, relaunched its search engine Bing adding a search-specific “next-generation OpenAI large language model that is more powerful than ChatGPT,” according to a release. Google is experimenting with a conversational AI service called Bard. Even Snapchat is adding a “My AI” feature that enables users to message with ChatGPT inside the app. 

Curious what it takes to code your own chatbot? In the beginner-friendly course Build Chatbots with Python, we’ll walk you through how to build chatbots that can teach themselves. For a deeper dive into natural language processing, consider taking the path Apply Natural Language Processing with Python

Can ChatGPT teach you how to code?

Well, yes and no.

You can ask ChatGPT to write code for you just by typing a request in plain English, and it’ll instantly spit out ostensibly workable code. That could be very handy in times when you can’t remember specific syntax and don’t have time to look up the documentation, or you need to browse some sample code. You could even ask ChatGPT to debug your code for you in a pinch. Pretty sweet, right?

Julie Jones, a Software Engineer at Codecademy, used ChatGPT recently to help her code a calendar app for personal use. Julie was building this app from scratch in Ruby on Rails, and couldn’t remember how to nest an object. “I didn’t have the brainpower at that time to think about, how do I place the object together?” Julie says. “I was like, Hey, these are my models, this is how I want it nested, and ChatGPT spit back the exact code that I literally copied in, and it worked. It was just amazing.”

“The reason we write code and we don’t write natural language is because natural language is ambiguous. That ambiguity can’t really be coded around.”

Ada Morse
Codecademy Curriculum Developer in Data Science

But ChatGPT can also make errors along the way, or get tripped up by certain requests — just like humans who write code. OpenAI’s website is forthcoming about the limitations, stating: “ChatGPT sometimes writes plausible-sounding but incorrect or nonsensical answers.” As an experienced programmer, Julie knew what types of clarifying questions to ask ChatGPT, and could verify that the code for her app was correct. Someone at the beginning of their coding journey, however, might not be able to contextualize ChatGPT’s responses, or pick up on subtle mistakes. 

Programmers are trained to be precise and detail-oriented, so accuracy is a concern, even when it comes to the basics. “The reason we write code and we don’t write natural language is because natural language is ambiguous,” Ada says. “That ambiguity can’t really be coded around.” 

If you’re solely relying on ChatGPT to learn how to code, you could be missing out on some crucial programming principles — like knowing how to solve problems, understanding how to read tech documentation, getting comfortable with trial and error, and building things on your own. “With coding, you need to know the fundamentals,” Julie says. “If you don’t know the fundamentals, then I don’t think the tool will be that helpful to you.”

On top of that, there are nuances to the human experience of learning that are difficult to replicate with AI. For example, research on how we learn suggests that some amount of confusion can be beneficial for learning. “So, even if ChatGPT always gave you the right answer, sometimes that would actually slow down your process of learning the concepts and being able to do it yourself,” Ada says.

Will ChatGPT replace software engineers?

People have been spooked that automation and machines will replace human workers since the Industrial Revolution. ChatGPT is already changing how engineers do their jobs, and potentially making them more productive and efficient. But that doesn’t mean generative AI is a direct proxy for a human programmer. 

Neil Daftary, an Engineering Manager at Codecademy, uses Github’s code-writing AI tool called Copilot to speed up the process of writing boilerplate, scaffolding (for example, creating a new component), and tests. “It could help with learning to code, but I think it’s more useful if you’re a bit further in your journey and have some idea of why Copilot is suggesting what it does,” he says.

Just take it from ChatGPT itself:

There are countless ways that tech workers in specific roles can (and probably will continue to) utilize AI tools like ChatGPT in their work. Some practical uses for ChatGPT that we’ve heard include: troubleshooting code instead of using a search engine; using it as a coding assistant to handle simple but tedious tasks; and explaining complicated concepts in simple language. Not to mention: As adoption of AI tools continues and spreads to other industries outside of tech, the demand for engineers who understand how to build AI products will rise, too. (Want to get a headstart on learning the skills used to build these types of applications? Check out our catalog of machine learning courses.)

Even with exciting, time-saving AI innovations like ChatGPT, there are very real limitations to the technology. ChatGPT lacks a true human touch; it doesn’t understand context and it doesn’t have subject matter expertise, Ada says. (Chatbots are also susceptible to bias, which is an issue that spans across AI.) Theoretically speaking, if an organization axes all their developers and uses AI tools instead to write code, “they’re probably just going to end up introducing a ton of bugs and a ton of problems,” she says. 

The bottom line

There’s so much more to coding than just knowing how to type exactly the right combination of letters and symbols into a computer. Learning to think like a programmer also means expanding your creativity, solving problems, communicating effectively, and collaborating with a team. 

Even ChatGPT agrees that you’re better off “using online coding environments or tools to practice coding on your own or collaborating with a teacher or mentor to guide you through your coding journey.” Take a look at how the chatbot answered this question for us:

If you’re going to use ChatGPT as you learn to code, we totally get it, but we recommend treating it like a study buddy. “Imagine you’re taking a class with someone who’s maybe really confident about how good they are in that class, but they’re actually not always correct,” Ada says. You might appreciate your study buddy’s suggestions or ask for their perspective on things, but you take it all with a grain of salt. 

That said, ChatGPT shouldn’t be your only study buddy. Don’t neglect other valuable resources like getting involved with the Codecademy community and asking questions in the forums. When you connect with other developers who have a bit more knowledge or experience than you, they can “sort of help you get over a hump without giving away the whole solution,” Ada says. 

Ultimately, ChatGPT shouldn’t discourage you on your coding journey — if anything, it should inspire you to want to learn more about this technology. Codecademy has lots of courses about machine learning that will teach you how to create and work with deep learning. If you’re interested in having a career in this exciting field, check out the path Data Scientist: Natural Language Processing Specialist

Related courses

7 courses

Related articles

7 articles
Header-Image_2083x875-12.png?w=1024

What is the Waterfall Model?

06/07/2024
7 minutes
By Codecademy Team

T​​he waterfall model follows a linear sequential flow where each phase of development is completed and approved before the next begins. Here’s how it works.