Kanu

To travel… to wander… that's my instinct.

Erick Donado

← All notes

Learning to code when AI can write it for you

5 min readprogramminglearningai

AI is not replacing software engineers overnight. It's a tool, and a very good one: it takes the repetitive parts of the job, the boilerplate and the clean-up, off people who already know what they're doing.

That last part is the catch. Ask an AI for something in a language you've never touched, and when the code it hands you is broken, you won't know where. So you paste the error back, it guesses again, and the two of you go in circles. Nobody in that conversation can read the code.

When you can program, three things change:

  • you know what to ask for, so the AI actually speeds you up
  • you can tell when what it gave you is nonsense
  • you're not stuck when it's down, or when your credits run out

Often the bug is so small that reading the code yourself is faster than three rounds with a chatbot. You created two objects in the wrong order, and you can see it in ten seconds. The AI can't, because it's focused on the task and doesn't know everything you know about how you want it done.

Someone who can code and uses AI well beats both the person who refuses to use it and the person who uses it blindly.

Pick a language for a reason

Before choosing a language, decide why you want to program. The field is huge, and different parts of it use different languages.

There's no bad language. There are languages that fit a job and languages that don't. For machine learning and data science that means Python: the libraries are there, and it's quick to try ideas in. You wouldn't write a neural network pipeline in C, and you wouldn't write an operating system in Python.

Ignore anyone who tells you their favorite language is the best one. Best for what?

The loop

Learning to program is a loop with two steps:

  1. Learn some syntax.
  2. Build something with it.

Then back to step 1. There's no secret beyond that.

The whole method. Every pass around the loop, the projects get a little harder.

Learning syntax

Syntax is the rules of a language: how you write a loop, a function, a class. Every language has its own, so even someone who knows five languages has to learn the rules of a sixth. What they have is speed. If you know Python, JavaScript comes easier, because both are scripting languages. If you know what a pointer is from C++, Rust's smart pointers make sense sooner.

Use a free site with exercises, like W3Schools or Codecademy, or just play with the language in your editor. You're ready to move on when you can declare functions, create objects, join strings and use the basic data structures without looking at a tutorial.

Learning a language is also learning:

  • what it's for (TypeScript for web apps, Rust for engines and operating systems)
  • why it's built the way it is (one runs on an engine that interprets it, the other compiles down to the machine's own instructions)
  • what that costs (what's fast, what's slow, and when it matters)

If you commit to a language, look under the hood too: how function calls use the stack, why global variables cause trouble, how memory gets handed out and taken back. It's optional, and it will quietly make you better, because you'll notice when you're writing something wasteful. It's why computer science courses teach theory before building.

Building projects

Don't know what to build? This is a great thing to ask an AI:

For Python, give me 3 project ideas at each level: beginner,
intermediate and advanced. For each one, list the features
to build and the concepts I'll learn.

You'll get nine projects, each with its features and what it teaches. The start of the answer looks something like this:

The answer names the project, what to build and what you'll learn from it. That last line is what makes it a study plan.

Build all nine, start to finish.

And here's the rule that matters: build them without AI help. The industry does lean on AI to write code now, and companies want more output than ever. That's exactly why you need the habit of thinking for yourself first. An AI is only as good as the person steering it.

When you get stuck, these have an answer for almost everything:

  • W3Schools: syntax with exercises
  • GeeksforGeeks: an explanation of nearly every concept
  • Stack Overflow: someone already asked your question, and got a blunt answer
  • Codecademy: guided, step by step

If you do use AI while learning

I teach programming, and I see the same thing every time: a student with an AI open finishes the exercise and still can't write the next one alone. The code got done; the learning didn't. A few rules keep that from happening.

Try first, then ask. A broken attempt shows you exactly what you don't understand, and that makes your question good.

Ask for explanations, not solutions. "Why does this loop never end?" teaches. "Write me a loop that does X" doesn't. Try telling it: "don't give me the code, give me a hint."

Give the bug twenty minutes. Read the error from the bottom up, print the values, shrink the problem. Most of the time you'll find it.

The line-by-line test. Before keeping any code, explain every line out loud. If there's a line you can't explain, you're not done.

Things to remember

  • Impostor syndrome is normal. Everyone feels it. Learning the next thing is what quiets it, for a while.
  • It's your path. Don't measure yourself against other people's.
  • Ask the small questions. An AI is a tutor that's awake at 3 a.m. and never gets tired of "why?".
  • Don't slide into copy and paste. The moment you're pasting code you don't understand, you've stopped learning.
  • Find people. A community of others who are learning pulls you up with it.

The short version

Use AI like a tutor while you learn, and like a colleague once you can check its work. Never like a ghostwriter for things you're supposed to understand.

← All notes