Lesson 1

What Programming Really Is

Before you write a single line, one idea has to land: a computer is not smart, and it is not stupid. It is literal. Everything else you learn here is you getting better at saying exactly what you mean.

15 min Beginner — no experience needed Phase 1 · Foundations

Your goal

Explain in your own words what a program is, put a set of instructions in the right order, and run your first piece of Java in the browser.

1 Why this matters

Ramming speed

The code said drive forward for two seconds. The drivers expected the robot to stop at the line. Instead it drove straight into the wall.

Nothing was broken. No motor failed. No wire came loose. The robot did precisely what the code said — the code just said the wrong thing. Two seconds of driving was farther than the wall was away.

That story is the whole lesson. A computer is not smart and it is not stupid — it is literal. It has no idea what you meant. It only knows what you wrote.

Everything you do for Team 2551 from here on — motors, sensors, autonomous — is you getting better at saying exactly what you mean.

2 What a program actually is

A program is an ordered list of instructions. That's it. The computer starts at the top and does one line at a time, all the way down, without skipping and without rearranging. That behaviour has a name: sequential execution.

Think of a recipe. A recipe is useless as a pile of unordered steps — “bake for 20 minutes” before “mix the batter” produces garbage. Order isn't a detail of the recipe. Order is the recipe.

You already do this. Before every match, someone on the team reads a checklist out loud: battery in, bumpers on, tether unplugged, robot on the field. That checklist is an algorithm — a finite list of clear steps, in order, that gets a job done. Write that same checklist in Java and it's a program.

Mental model

You are writing a recipe for the most obedient, least imaginative chef alive. It will follow every step perfectly — and it will never once notice that a step is missing.

So you already write algorithms constantly. Programming is only the translation step.

3 The language and the compiler

Computers only accept very precise languages. It's like ordering food in a language you barely speak: one wrong word and you get nothing — not a helpful guess. The rules of that language are called its syntax.

We write in Java, because that's what FRC robots are programmed in.

Here's the pipeline. You write source code — text a human can read. A compiler checks it for syntax mistakes and translates it into something the machine can actually execute. If the compiler finds a mistake, it refuses to translate and tells you where it choked.

That refusal is a feature

An error message is the compiler catching your typo before the robot does something expensive. It is help, not punishment. Lesson 6 of this unit is entirely about reading what the compiler tells you.

4 Input → process → output

Every program, without exception, is three steps: take something in, do something with it, put something out.

The intake on the robot is the perfect picture of it. A game piece goes in (input), the rollers grab and index it (process), the shooter fires it out (output).

A program that reads a joystick, decides a motor speed, and sets the motor is the exact same three steps. On this page our output is text on a screen. In Phase 2, the output is a spinning motor — but the shape never changes.

5 Order is the program

Here is a complete, working Java program. Don't worry about the first two lines — taking those apart is the next lesson's whole job. For now, look only at the middle.

Main.java Java
public class Main {
    public static void main(String[] args) {
        // Step 1
        System.out.println("Battery installed");
        // Step 2
        System.out.println("Bumpers attached");
        // Step 3
        System.out.println("Robot on the field");
    }
}
public class Main { … }
A named container for the program. We take this apart in the next lesson — for now, copy it.
public static void main(...)
The starting line. The computer looks for this and begins here.
System.out.println("…")
One instruction. It means print this text on its own line.

Running it prints exactly this:

output
Battery installed
Bumpers attached
Robot on the field

The output order is the code order. Always.

Now watch what happens if we keep the same three instructions and just swap two of them:

Main.java · reordered Java
public class Main {
    public static void main(String[] args) {
        System.out.println("Robot on the field");
        System.out.println("Bumpers attached");
        System.out.println("Battery installed");
    }
}
output
Robot on the field
Bumpers attached
Battery installed
This is valid Java

The compiler is perfectly happy with it. It cannot tell that putting the robot on the field before installing the battery is nonsense — that's a fact about robots, not about grammar. Only you know the intent. This is the single most important idea on this page.

6 Run it yourself

This isn't a picture of code — it's a real Java compiler. Press Run ▶ inside the panel and read the order it prints. It's wrong: the robot goes on the field before the battery is in.

Your job: cut and paste whole lines until the output reads battery → bumpers → tether → field.

You don't need to understand the words yet

Move whole lines around. That is already programming. Understanding what's inside each line is the next lesson.

First run is slow

The very first run may take a few seconds while the compiler warms up. That's normal — later runs are quick. If the panel ever won't load, use “Open in new tab ↗” and paste the code there.

7 Practice challenges

Reading is easy to fool yourself on. These make sure it actually landed.

Predict the outputWhat gets printed?

Java runs these top to bottom. Type the three words in the order they come out, separated by spaces:

System.out.println("Enable");
System.out.println("Drive");
System.out.println("Shoot");
Show explanation

Each println prints its text on its own line. Nothing in the program says “sort these” or “pick the important one,” so the order printed is simply the order you typed.

Multiple choiceWhat counts as an algorithm?

Which of these is an algorithm?

Fill in the blanksHow code gets run

Click each dashed box and type the missing word.

The text you write is called source , and the tool
that checks it and translates it for the machine is called a .
Multiple choiceBack to the wall

You told the robot to drive forward for 2 seconds. It drove into the wall. What almost certainly happened?

8 Common misconceptions

Get these out of the way now
  • “The computer will figure out what I meant.” It will not. It has no idea what you meant, only what you wrote — which is why being exact is the entire skill.
  • “Programming means memorising a lot of commands.” You'll look syntax up forever. What you're actually building is the habit of breaking a job into ordered, unambiguous steps.
  • “If it's not broken it must be right.” Code that runs without an error can still do the wrong thing. A program that compiles is only a program that is grammatical.
  • “Real programmers don't get errors.” Everyone on this team gets errors every meeting. The difference is only how fast they read them.
  • “I need a good laptop before I can start.” You need this browser tab. One season the captain's laptop died and he wrote the season's robot code on the driver-station laptop.
Mini-project

The Pit Crew Checklist

Every match, someone on 2551 runs a pre-match checklist out loud. Turn a real checklist into a program — using only what you learned on this page.

  1. Print a header line: PRE-MATCH CHECKLIST.
  2. Print these five steps, each on its own line, in an order that makes physical sense: battery installed and strapped, bumpers on and correct colour, tether unplugged, robot powered on, robot placed on the starting line.
  3. Print a closing line: Ready to play.
  4. Bonus: number your steps in the printed text so a human reading the console can follow along.

While you're here: deliberately break it once. Delete a semicolon, press Run, and look at what the compiler says. You won't understand the message yet — the point is to learn that a red error is information, not punishment.

Stuck? Reveal one possible solution
solution · Main.java
public class Main {
    public static void main(String[] args) {
        // A pre-match checklist, printed one step at a time
        System.out.println("PRE-MATCH CHECKLIST");
        System.out.println("1. Battery installed and strapped in");
        System.out.println("2. Bumpers on, correct alliance colour");
        System.out.println("3. Tether unplugged");
        System.out.println("4. Robot powered on");
        System.out.println("5. Robot on the starting line");
        System.out.println("Ready to play.");
    }
}

Any order that makes physical sense is a correct answer — but “robot on the field” before “battery installed” is how you lose a match. The compiler would have accepted it happily.

Checkpoint

0 / 5
Q1. A program is best described as…
Q2. Why do we say a computer is “literal”?
Q3. What is a compiler's job?
Q4. Two programs contain the exact same three println lines, in different orders. Are they the same program?
Q5. You wrote code and got a red error message. What's the right reaction?
That's the foundation.Next: we take that public class Main apart line by line, and you write a program you fully understand.