AI WEEK IS HERE: See All New AI Courses here.
Use Code: LEARNAI to get 21% OFF any membership. Expires soon 👇
06DAYS09HOURS18MINS19SECS

How To Use ChatGPT To 10x Your Coding

Alex Hyett
Alex Hyett
hero image

Everyone at the moment seems to be obsessed with ChatGPT.

On one side, we have the doom-sayers who are freaking out and saying this is the start of an AI-driven revolution and the beginning of the end for many jobs.

the end of coding

While on the other side, people think it's nothing more than parlor tricks, merely mimicking intelligence and will never be able to replace human creativity.

the future of coding

What's that? Complete opposite takes from the exact same website 😂. Anything to gets those clicks!

So what gives? Are tools like ChatGPT good or bad for the future of coding?

Well, I think the actual answer lies somewhere in the middle. In the short-term (next few years), this will be a really exciting space that will spawn a bunch of great tools to make our lives better and easier.

From what I've seen and personally experienced so far, developers are crazy to not at least give ChatGPT a try. (Let's be honest, all of us developers are constantly googling and using stackoverflow for answers but no one is worried about them "taking over").

If you frame ChatGPT as another tool for you to help solve your problem at hand rather than your AI arch nemesis trying to take your job, you'll quickly become a big fan.

Don't just take my word for it though...

ZTM recently ran a study of over 3,000 programmers and their experience with AI tools such as ChatGPT.

The results?

The majority of people are still figuring out how to use it, but some programmers are absolutely killing it, using AI tools to help with 30% of their work or more!

ai tools and programming survey

The founder of ZTM (Andrei Neagoie even just dropped a video on how to actually thrive with AI:

So as you can see, this is a skill that's worth learning how to use, so let's break it down.

We'll start with the basics but then I'll give you my own personal examples of how I've used ChatGPT for coding and also give you some tangible ideas and examples of ways you can 10x your coding to work smarter, not harder.

What are LLMs? What is GPT?

GPT, which stands for Generative Pre-trained Transformer, is a Large Language Model (LLM) created by OpenAI and trained on petabytes of data scraped from the public web, as well as the entirety of Wikipedia and a large corpus of books.

If you've used it before, then you'll know that it's capable of generating human-like responses, writing code and providing suggestions for real-world problems.

So how does an LLM actually work?

At its simplest level, LLMs try to predict the next word in a sentence, one word at a time. This doesn’t sound like much, but GPT-4, the latest model from OpenAI, is already able to achieve scores above the 90th percentile for several standardized tests such as SAT and the Uniform Bar Exam.

As it learns more and more, it's able to give more advanced answers to questions.

They key thing to understand for now is that that no, it can't steal your job or outsource it completely, but it can definitely help you to streamline your efforts, save you time, and make you more productive.

If you want to see how LLMs like ChatGPT are going to revolutionize software engineering, watch the video below.

Your new programming assistant (yes, ChatGPT can actually write code)

Let's get into the good stuff. You want know... "what can ChatGPT do for me", right?!

With each iteration, AI is getting better at producing more convincing answers, as well as generating working code examples.

Many developers (myself included) are already using ChatGPT as a programming assistant to help them:

  • write code
  • solve bugs, and
  • write unit tests

These same tasks which used to take hours of Googling and scrolling through unhelpful StackOverflow posts can now be solved in a few minutes with AI assistants.

Better still, ChatGPT is familiar with many packages and frameworks and can give you recommendations and working code without you needing to read lengthy documentation.

On top of that, there are tools such as GitHub Copilot and Amazon CodeWhisperer that plug straight into Visual Studio Code, providing you with a seamless programming assistant.

github copilot

Pros and cons of AI tools

Now that I have you all hyped up, it's important to know that there are also downsides.

The most obvious pro is simply that AI has lowered the bar for people to get into Software Development.

No joke, there have been examples of people creating games, mobile apps and websites with the help of ChatGPT, despite having no prior programming experience.

If results like this are possible with no previous knowledge, just think about what can be achieved in the hands of an experienced developer.

Also, even though ChatGPT and other AI tools are incredibly powerful, they aren’t infallible.

Hallucinations and the need for experience

At the moment, “hallucinations” are still common. This is where AI will generate something that sounds plausible but is in fact nonsense. To the undiscerning eye, the output looks reasonable, but on closer inspection, it isn’t correct.

From recommending packages that don’t exist, to generating code that just doesn’t work, AI-generated output can’t be trusted without verifying it yourself first.

That website it just built you or that app?

How do you know it works, or that it doesn't have backdoor access for easy hacks? You don't, which is why you still need domain level knowledge to truly use this effectively, but that's not a bad thing at all.

This is where actually learning how to code and having a deeper understanding of how and why things work the way they do will still be extremely important.

  1. You need to know what to even ask it in the first place
  2. You need to understand the code it's giving to you to be able to incorporate it into your app or website
  3. So far, I've found it's best for very specific, distinct tasks (but doesn't yet act or think like a full-time programmer)

It can save you time and effort

Even with the limitations, AI can be an incredible time saver for developers, allowing us to automate tedious tasks such as creating boilerplate code and writing unit tests.

For example

As a Backend Developer, I often need help when it comes to anything Frontend related. This can be a problem given my personal blog is a Gatsby static site which uses React.

The other day I wanted to add one of those horizontal scroll bars to the top of my articles so readers knew how much they had left to read. ChatGPT to the rescue!

I asked ChatGPT the following:

The problem

ChatGPT proceeded to give me a few options as well as the code I needed to use to implement them.

the solution

I went with the first option and then used ChatGPT to help me add a gradient effect to it as well.

Except it wasn’t working how I wanted it to. I didn’t want the gradient to resize along with the progress bar. Again ChatGPT helped with the solution.

Narrowing down the answer

ChatGPT responded with:

The ideal solution

In most cases, ChatGPT won’t give you code that can just be copied and pasted but it is very good at understanding your meaning and giving you an answer quicker than search engines can.

Speed up your learning

Generating code isn’t all ChatGPT can do for you as a developer, it can also act as your own personal tutor.

For example

If you're struggling with a complex topic, you can ask ChatGPT to explain it. Then, if the answer still doesn’t make sense, you can ask the AI to simplify it for you or rephrase it, so even a child could understand it.

simplify answers

Pretty handy right?

ChatGPT is also great for non-native English speakers looking to learn how to code.

For example

If you were to ask it,

¿Puedes explicarme qué es la idempotencia en el desarrollo de software?

ChatGPT will then go ahead and explain idempotency to you in Spanish! This means that language no longer needs to be a barrier to learning programming.

It's not just beginners who can benefit from AI tools though. It can also be used by experienced developers to try out new programming languages.

For example

ChatGPT is capable of converting small snippets of code into different languages to help developers learn the syntax differences between each language!

It doesn't end there either.

  • Struggling to understand what a piece of code is doing? Then ask ChatGPT to explain it to you, line by line
  • Want to learn a new subject? Ask ChatGPT!

Sure, AI isn’t going to replace the role of expert tutors, as it lacks the real-world experience that these teachers are able to pass on to their students. However, when used as a learning assistant, it can be incredibly powerful, as it can answer almost all your questions and has endless patience.

There are still quite a few hurdles to overcome before AI will be introduced to the schooling system, but when it does, it will transform the way that children and adults learn.

Will ChatGPT / AI replace programmers?

Alright, let's address the elephant in the room.

Given how much AI can already accomplish, is it only a matter of time before AI starts replacing developers?

No. AI still has a long way to go before it's able to produce production-ready code.

For example

When asked to generate code to call an API, it will often suggest embedding the API key in plain text directly in the code.

Unless prompted to do so, it will be unaware of programming best practices and so it requires an experienced developer to validate what has been produced.

Another common issue (no pun intended)

When asked to fix an issue in the code it has generated, ChatGPT will typically give you a completely different version which introduces further defects.

more errors

Why does this happen?

Currently, ChatGPT is trained on publicly available code found from sources such as GitHub and StackOverflow, most of which isn’t written to a high enough standard to be used commercially.

stack overflow used as chatgpt training

Big picture complexity failure

AI does well when asked to produce small pieces of code, but regularly fails when tasked with creating whole applications, let alone large microservice architectures used by companies today.

AI also lacks sufficient domain knowledge about businesses to solve any real problems, and that is unlikely to change for the foreseeable future.

Not only is your job safe from AI tools - but it could be easier when you embrace them

Where AI does shine is when developers use it as an assistant to help with coding tasks. ChatGPT and GitHub Copilot have already been shown to greatly speed up development by automating mundane tasks and boilerplate code generation.

There may come a time when AI is capable of producing better code, faster than any human developer.

It's not the tools you need to worry about...

The threat to your job doesn't come from AI itself, but from other developers who have learned to embrace these tools and gain better AI skills than you.

Why?

For a long time now, people have been discussing the concept of a “10x developer”, who can solve problems and write code ten times faster than the average engineer.

Thanks to AI tools like ChatGPT, developers will be able to achieve much more, and it will be a required skill that many employers will be looking for.

10x coders

Prompt engineering and AI

So how do we use AI effectively so that we can become that 10x or 100x developer?

The answer is in what has been dubbed “Prompt Engineering”, which really is nothing more than being able to communicate effectively with AI tools.

Let me explain:

For those that have been underwhelmed by AI, it is usually due to the prompt that has been used rather than limitations in the tool itself. If you use mediocre prompts, you will get mediocre responses.

As was the case in the early days of computing, if you put garbage in, you will get garbage out.

To achieve the full potential of AI tools, you need to be good at crafting well-structured prompts that not only ask what you want, but in a way that will deliver the correct response from the AI.

prompt engineering

You may have seen people start prompts with “You are EngineerGPT…”.

This is one way to frame your prompts so that the AI will know how to respond to your queries and provide the correct level of detail (i.e. at the level of an Engineer).

As mentioned, code produced with ChatGPT will often lack the use of best practices, but with the correct prompt, it is possible to get the AI to generate what you had in mind much faster than coding it yourself.

This is where experience comes in, and having the ability to instruct the AI to use a certain design pattern or a particular framework can greatly improve the output you can get.

Even if AI does generate a lot of code for us in the future, developers still need to know how to code to be able to instruct the AI and validate what is being produced.

How to start using ChatGPT today

OK, let's look at 3 other examples of how you can use this tool and start to become a 10x Developer.

Editor's note: Although these are just basic ways to use this tool to improve your coding right now, we're going to be updating this post regularly with new methods and examples.

Not only that, but all future courses we're creating here at ZTM will be looking at how to use tools such as ChatGPT as a pair programming assistant. This means new methods and hacks to make your life easier, regardless of language or framework.

1. Use ChatGPT to explain regular expressions for you

Regular expressions are notoriously difficult to understand yet they are used a lot in programming.

Take this example. Any ideas for what this is used for?

/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/i

Let’s ask ChatGPT:

Use chatgpt to learn what code means

The response is mind-blowing 🤯.

the code breakdown

Not only does it now that this is a regular expression for validating email addresses, but it also goes on to tell you what each piece of the expression is doing!

This is just one example but the next time you feel stuck on a topic, ask ChatGPT to explain it to you and provide you examples. You'll be amazed at how convenient and helpful having this private little tutor is.

2. Use ChatGPT to write SQL commands for you

Knowing how to query a database is an essential skill that all developers need to know but sometimes it can be difficult to come up with the right query.

However, if you give ChatGPT enough information about the structure of the database it can write the query for you instead!

Using chatgpt to solve sql coding issues

From the information provided ChatGPT managed to work out the correct foreign keys to match and write the correct query for me.

the code solution but does it work?

💡 Reminder: Remember what I said earlier though about domain level knowledge and giving good prompts.

Here you can see that the type of database above is clearly for MySQL instead of MS SQL. This could be down to my own prompt quality, but without the domain knowledge, I wouldn't have spotted this issue.

3. Use ChatGPT to save yourself from Git headaches

We've all been there. You're asked to make a one line code fix and end up committing it directly to the master branch without creating a feature or hotfix branch.

Gah!

All is not lost though as you haven’t pushed it up to GitHub yet so how do you roll back this mistake? Sure, you could start panicking and searching Google, but don’t worry, ChatGPT has your back!

GIT commit issue

The response from ChatGPT even made me feel a bit better about my mistake too and gave me advice had I pushed my changes up to the server, with a very important warning as well.

GIT commit solution

We're just scratching the surface with these examples...

ChatGPT is also capable of giving you book recommendations, generating learning roadmaps, helping you write Linux commands and bash scripts, and can even tell you why your code isn’t working.

If you want to see it in action, just go to ChatGPT, create a free account and type in: "What are the best restaurants in {{your_city}}."

It becomes almost like an addicting game seeing what kind of info you can extract and finding ways to get it to do tasks for you.

How will AI shape the future of coding?

As AI continues to advance and gain wider usage, it is inevitable that it will cause disruptions to several industries, and software development is no exception.

Throughout history, there have been many technological revolutions. With the Industrial Revolution, we saw machines take over the jobs of a lot of farm workers, who then found new jobs working in factories in the city.

The general argument for advancing technology is that it creates more jobs than it destroys. With each new development, however, the skill gap between jobs lost and jobs created is widening.

Over the last 30 years, the internet, and the digital revolution have seen jobs such as encyclopedia salesman and camera film developers completely disappear. New jobs such as a Web Developer, SEO consultant and social media strategist have been created.

In the past, the skills developed by farm workers could have easily been transferred to working in a factory, but the same is not true in the modern world. It would take considerable training for an encyclopedia salesman to learn Web Development.

Editor's note: Here at ZTM, we've taught literally hundreds of thousands of people to code with zero prior experience. We won't sugarcoat it, it definitely takes time and effort, but if you have that, we can give you the exact steps to take. We've even had students employed in $100k a year jobs in just 6-9 months of starting to learn.

Low-skilled work that is merely just an endpoint to a computer, such as data entry jobs, will likely be the first to go as AI advances. It will be these workers who are more likely to be negatively impacted, as it will be harder to take advantage of the new jobs being created.

Kai Lentit has a great joke in his latest video.

"Everything that I used to outsource to Fiverr, I now outsource to ChatGPT".

The seed of truth here being that small tasks that can be done in 2 minutes by certain skill-sets, can now be automated.

Fortunately, as Software Developers, we can be at the forefront of new job opportunities.

As long as we remain up-to-date with the latest technologies and figure out the best ways to utilize AI to our advantage, your career has never looked better.

Continued learning is the key to not getting left behind in an AI-driven world

If you want to stay ahead and make the most of AI, then it is worth taking ZTM's ChatGPT and Large Language Models course to get up to speed on prompt design and more.

Don't worry about these new tools. Learn them, use them, and become even more valuable.

About the author

Alex is a Software Developer and Engineering Manager with over 12 years of professional experience in backend development. Most of his career has been spent creating large-scale solutions for the finance industry from banks to payments startups. Alex has extensive experience with .NET, AWS and Terraform to name a few.

He is now using his experience to teach other developers about complex engineering topics and to help them have successful careers in tech.

Alex goes beyond just writing code and teaches developers the skills they need to break down large problems, communicate effectively with the business and work their way up the career ladder.

He regularly posts software development content on his YouTube channel as well as writes a weekly newsletter called The Curious Engineer to help engineers level-up their careers.

We highly recommend you check out both!

When not working, Alex likes playing guitar, reading, drawing and spending time with his wife and children.

Come say hi and welcome Alex in the ZTM Community!

More from Zero To Mastery

Will AI Replace Programmers? No! But Something Else Will preview
Will AI Replace Programmers? No! But Something Else Will

The better question is: "How do I NOT get replaced by AI?". I'll show you what could replace you and how you can thrive as a developer in this new AI era 🤖.

The State Of AI Tools And Coding: 2023 Edition preview
The State Of AI Tools And Coding: 2023 Edition

We surveyed 3,240 Developers, Programmers, and Engineers (biggest AI survey to date) to find out what's really going on with AI tools and programming. Here are the stats you need to know.

How To Become An AI Engineer From Scratch in 2024 preview
How To Become An AI Engineer From Scratch in 2024

AI is one of the fastest-growing areas in tech and is set to change the landscape of every industry. Learn how to become an AI Engineer in under 12 months 🚀