Skip to main content
Building with AI (Vibe Coding)

⏱ About 15 min15 XP

Things Will Break — That's Normal

The first time your code does something unexpected, your instinct might be to think you did something wrong, that you are not cut out for this, or that you broke something permanently. Every one of those thoughts is a lie. Every programmer who has ever shipped software — from a sixth-grader making their first website to the engineers who built the apps on your phone — has stared at broken code. Breaking things is not a sign you are failing. It is a sign you are building.

Why Bugs Exist at All

Software is built from instructions, and instructions are written by humans. Humans make mistakes: typos, logic errors, forgotten steps, wrong assumptions. A bug is simply a mismatch between what you told the computer to do and what you actually wanted it to do. That mismatch is normal because human thinking is not perfectly precise, and computers are ruthlessly literal. Consider this analogy: if you text a friend 'meet me at the park' and they show up at a different park, was that a catastrophic failure? No — there was a gap in communication. A bug works the same way. You said something; the computer heard it precisely; the result was not what you meant. Your job is to close that gap.

What a Bug Really Is

A bug is a gap between your intention and your instruction. The computer did exactly what you wrote. The problem is that what you wrote was not quite what you meant. That is always fixable.

Here is a real example. A student building a quiz app wrote code that was supposed to show the score at the end. Instead it showed zero every time. Nothing crashed. Nothing exploded. The computer just followed the instructions perfectly — and the instructions said to display a variable that was never updated. The student fixed it in two minutes once they spotted the gap. The bug was not scary; it was just a missing step.

The Debugging Mindset

Professional programmers talk about the debugging mindset — a specific way of thinking when things go wrong. It has four moves: 1. Stay curious, not defensive. The bug is not accusing you. It is giving you information. 2. Assume the computer is doing exactly what you told it. The error is in the instructions, not the machine. 3. Narrow the problem down before trying to fix anything. Guessing randomly wastes time. 4. Change one thing at a time. If you change five things and the bug disappears, you still do not know what fixed it. This module will teach you each of these moves in detail. For now, the most important thing is the first one: stay curious.

Match each debugging mindset move to what it prevents.

Terms

Stay curious, not defensive
Assume the computer is literal
Narrow before fixing
Change one thing at a time

Definitions

Wasting time on the wrong part
Giving up or blaming yourself
Not knowing what actually fixed it
Blaming the machine instead of the code

Drag terms onto their definitions, or click a term then click a definition to match.

Debugging with AI Changes the Game

When you build with AI tools, you have a collaborator available around the clock who has seen millions of bugs. That is powerful. But it does not change the mindset you need — it amplifies it. If you panic and dump confused descriptions at the AI, you will get confused answers. If you approach bugs with curiosity and precision, the AI becomes a remarkably useful thinking partner. The lessons ahead will show you exactly how to do that: reading error messages, describing bugs clearly, asking for fixes in a way that actually works, and — crucially — checking whether the AI's answer is actually right. The goal is not to get the AI to do your debugging for you. The goal is to be a sharp debugger who uses AI as a tool.

First Move When Something Breaks

Before you do anything else — before you delete code, before you ask for help — read whatever message the computer gave you. Even if you do not understand it yet, it contains clues. We will learn to decode those clues in the next lesson.

Why do bugs appear in software even when the programmer is skilled?

According to the debugging mindset, what should you do before trying to fix a bug?

Your Bug History

  1. Think of one time something you built or set up did not work the way you expected — a game, a school project, an app, anything.
  2. Write down: what you expected to happen, what actually happened, and what turned out to be wrong.
  3. If you fixed it, write how. If you did not, write what you tried.
  4. Share with a partner and notice: were your bugs accidents or carelessness? Or were they just gaps between what you meant and what you said?
  5. This is not a test. There are no wrong answers. The point is to notice that bugs have stories — and those stories are almost always fixable.