Using AI to Learn Programming?
Tags: ai, discuss, chatgpt, learning
Published: 2024-03-19 17:06:37

There are many ways to learn programming; in this post, I'll evaluate whether AI is a valid option. I've identified some shortcomings and some use cases where AI was beneficial. If you've used AI as part of your studies, let me know your experience and tips and tricks when using AI as a coding instructor.

I have a video on this topic, and in the video, I asked chatGPT if it could teach me to code. 

{% embed https://www.youtube.com/watch?v=mmT6MDD9tws %}

## What is learning?

A calculator wouldn't be beneficial when a kid is learning to add and subtract. Learning is about trying to come up with the answer by yourself. If you get into the habit of immediately reaching out to chatGPT for help, you are not learning. You have the illusion of learning, but you are not building a solid foundation. 

But there is also something specific about learning to code. Programming is a combination of problem-solving and translation. You must translate your thoughts and requirements into a sequence of instructions that a machine understands. Problem-solving and writing accurate machine instructions are skills that are acquired through practice. A question-answer interaction on chatGPT or generating code with a code assistant does not encourage you to develop the skills you need to become good at programming. Programming is challenging and complex, and every developer struggles at times. And it's by overcoming the challenges that you build durable skills. 

## AI Teacher Limitations

It's easy to be amazed at what AI can do. But AI has limitations you should be aware of. Under the ChatGPT prompt, you will see the following warning message.

> ChatGPT can make mistakes. Consider checking important information.

![ChatGPT Prompt Warnings](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9zcq3f2rnu16slxgwtog.png)

Of course, the responses are pretty good and helpful most of the time. Otherwise, no one would use AI. But what if I told you, "I will lie to you at some point in this post?"  Naturally, you would become suspicious. From that point, you'll pay close attention to everything you're reading to see if I'm lying.

That's my whole point: If someone is teaching you something, they should be fact-checking you, not the other way around. For example, if you don't know how AI works or what programming is and ask chatGPT, "Can you teach me programming?" how will you judge if the answer is accurate?

## Can I still use AI despite its limitations?

Despite the limitations, I think AI can still be used as a tool for learning. If you are still stuck after putting in the effort to try to understand a complex concept or solve a challenging coding problem, there is nothing wrong with asking an AI to help. 

![ChatGPT Promt: Can you explain server caching as if I was a 10 years old](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/irs6tz0relzlsznqzxfs.png)

But when the AI gives you the answer, don't stop there. Does the answer make sense to you? Can you test it? Does it work? Do you understand why it works? Remember, AI is not 100% accurate, so always stay on your guard.

In my opinion, AI  shouldn't be your principal or your only studying resource; instead, it should complement another type of material. Material that you can trust and that is compatible with your learning style. 

I believe the ideal situation to get the best out of AI as part of your learning is to have prior knowledge before reaching out to the AI. I think of AI as a study partner rather than a teacher—a study partner who is super intelligent but who can still make mistakes. 

## My favourite use cases

### Road map and study plans

Something that I do before I start tackling a complex or vast study topic is ask chatGPT for a summary of the topic. Then, when I dive into the subject in detail, I know how the different parts relate to the bigger picture. 

### Summary and high-level view of a topic

When I need a shallow understanding of an area, I feel quite confident asking ChatGPT about a high-level explainer. Especially if it's a topic that is well documented. I have found it much faster and more efficient than a google search.

### Generating quiz questions

After I finish a course or a book, I ask ChatGPT to quiz me on the topic I just studied. Even if the questions are not always great, at least I have some level of testing. 

----

I have mostly talked about ChatGPT and not so much about code assistant. You might disagree with me, but check out this this [video](https://youtu.be/9IzjrOnYrkA?si=H4XMR014KOy3kQW7) to know what I think about using them in your workflow.