1 Hour

1. Introduction to Programming

Module 01: Introduction

What is code, and why should you care?

Imagine you have the world's most literal-minded employee. This person will do exactly what you say — not what you mean, not what you intended, exactly what you said.

If you tell them to make coffee without specifying the steps, they'll stand there confused. But if you say: (1) fill kettle with water, (2) boil kettle, (3) add coffee grounds to cup, (4) pour boiling water over grounds... they'll make perfect coffee every time.

That employee is a computer. Programming is the act of giving it precise, step-by-step instructions. We call those instructions code. A program is just a set of instructions that a computer executes in order.

Your phone's weather app, a banking system, a self-driving car, Instagram's recommendation algorithm — they are all, at their core, a series of instructions telling the computer: do this, then this, then check this, then decide that.

Key Insight

A computer is incredibly fast and incredibly dumb. Your job as a programmer is to give it instructions precise enough that its speed becomes useful.

How Computers Execute Code

Hardware Architecture: The Fetch-Decode-Execute Cycle How instructions move from physical RAM into CPU execution SYSTEM RAM (Memory) 0x1000: LOAD count 0x1004: ADD 1 0x1008: STORE result Volatile byte addresses CPU (Processor Core) Control Unit Decodes Instruction ALU Math & Logic Engine Registers (Ultra-Fast Cache) PC: 0x1004 ACC: 42 FLAG: 0 1. FETCH 2. DECODE 3. STORE BACK

When you write code, something has to translate your human-readable instructions into something the computer's brain — the CPU (Central Processing Unit) — can actually execute. CPUs only understand one thing: machine code, which is a series of 1s and 0s (binary).

Here's the journey your code takes:

  • You write code in a high-level language like Python or JavaScript
  • A translator program (compiler or interpreter) converts it to machine code
  • The CPU executes those instructions one by one, at billions of operations per second
  • The result appears — on screen, in a file, or over a network

Understanding Software vs Hardware

Hardware is the physical stuff — the chips, the screen, the keyboard, the memory sticks. Software is the instructions that run on the hardware. You can't touch software; you can only run it.

Think of hardware as a piano and software as sheet music. The piano (hardware) makes sound possible. The sheet music (software) determines what song plays. A Beethoven symphony and a pop jingle can both run on the same piano — just like a game and a spreadsheet app can both run on the same laptop.

Writing Your First Program

Across almost every programming language, the first program anyone writes is one that displays a message. Here it is in Python:

Python 3
# My first program
print("Hello, World!")

And here's the same thing in JavaScript:

JavaScript
// My first program
console.log("Hello, World!");

That's it. Two things are happening here: (1) we're calling a built-in function (print / console.log) that outputs text, and (2) we're passing it a string of text in quotes. You've just seen two core programming concepts — functions and strings — before we've even formally defined them. That's intentional.

Setting Up Your Development Environment

Your development environment is where you write and run code. Here's the minimum setup you need:

  • Step 1 — Install Python: Go to python.org, download Python 3.x, and install it. Python comes with a REPL (a live coding playground) you can access by typing `python` in your terminal.
  • Step 2 — Get a Code Editor: Download Visual Studio Code (VS Code) from code.visualstudio.com. It's free, fast, and used by millions of developers worldwide.
  • Step 3 — Run Your First File: Create a file called `hello.py`, type `print(Hello, World!)`, save it, open your terminal in the same folder, and run:
Bash
python hello.py

# Output:
Hello, World!
You Just Did It

If you saw that output, congratulations — you are now a programmer. Seriously. The first run is always the most meaningful.

Knowledge Check

Ready to test your understanding of 1. Introduction to Programming?

Back