Free degree-level programming lessons for careful independent study.

Degree Level Programmes · Programming 1 · Lesson 2

The Appropriate Programmer

Develop the disciplined habits needed to learn programming from first principles rather than chasing copied answers.

Lesson Overview

Develop the disciplined habits needed to learn programming from first principles rather than chasing copied answers.

Portfolio focus: Write a one-page programming routine for each study session.

ConceptProgramming culture
Run fileAppropriateProgrammerDemo.java
Baselinepredict, test, run, explain
Evidence3 tasks

Starter: think before typing

Before running this programming culture example, find the line where the main idea becomes active. Write a prediction: what must already be true for that line to work, and what should be different after it runs? The checked run ends with `predict, test, run, explain`; predict how the focus line helps produce that evidence.

Learning Objectives

  • Explain why prediction matters before running code.
  • Use tool feedback as information rather than judgement.
  • Keep a programmer's notebook of mistakes and fixes.
  • Distinguish understanding from simply getting output.

Learning Outcomes

  • By the end of the lesson, you can explain why prediction matters before running code.
  • By the end of the lesson, you can use tool feedback as information rather than judgement.
  • By the end of the lesson, you can keep a programmer's notebook of mistakes and fixes.
  • By the end of the lesson, you can distinguish understanding from simply getting output.

Why this idea exists

The idea of the appropriate programmer is about professional habits, not personality. Programming rewards patience, evidence, naming, revision and honest debugging more than speed or guesswork.

This lesson sits near the beginning because weak habits become expensive later. If a learner copies code without predicting, testing and explaining it, topics such as methods, objects and algorithms become rituals rather than tools.

In the overall arc, this is the study-method foundation: a programmer learns to slow down, keep useful notes, make small changes and treat mistakes as information about their current mental model.

Deep dive

Mechanism in this example

The important mechanism is visible around `String habit = "predict, test, run, explain";`. Read it as a concrete move in the program, not as decorative syntax: identify what value, object, branch, call or boundary is being created at that point.

Design pressure

In the overall arc, this is the study-method foundation: a programmer learns to slow down, keep useful notes, make small changes and treat mistakes as information about their current mental model.

Failure mode to watch

For The Appropriate Programmer, deliberately disturb the assumption behind `String habit = "predict, test, run, explain";`: use an awkward value, missing input, wrong order of calls or boundary case. The useful question is how that disturbance exposes a weakness in the programming culture design.

Extension step

Extend the example by doing this: Keep a log of three mistakes and what they taught you. The point is to make one small change that forces you to revisit the concept, rather than adding unrelated features.

Portfolio standard

The portfolio note should not repeat the lesson wording. It should show the edited code, the run result, and your own explanation of this evidence: explain why rushing introductory code is a serious error of judgement.

Lesson visual

A focused student desk with a notebook labelled predict, test, run, explain beside a terminal showing a small Java program.
A focused student desk with a notebook labelled predict, test, run, explain beside a terminal showing a small Java program.Download visual

Type this and run it

Create AppropriateProgrammerDemo.java, type the program, and run it before changing anything. This section is about reproducing the checked baseline.

public class AppropriateProgrammerDemo {
  public static void main(String[] args) {
    String habit = "predict, test, run, explain";
    System.out.println(habit);
  }
}

Build and run it with:

javac AppropriateProgrammerDemo.java && java AppropriateProgrammerDemo

Expected baseline: predict, test, run, explain

Run the code in your browser

Use the editor as an experiment surface. First run the checked version, then make one small change to the part of the program that demonstrates programming culture and compare the new behaviour with the reference output.

Line-by-line explanation

Read the code as a sequence of responsibilities. The focus line for this lesson is String habit = "predict, test, run, explain";; the surrounding lines prepare it, use its result or make the behaviour observable.

public class AppropriateProgrammerDemo {

This names the runnable class for the The Appropriate Programmer example, giving the compiler and JVM one clear unit to build.

public static void main(String[] args) {

This is the program entry point. In The Appropriate Programmer, it keeps the demonstration of programming culture in one traceable starting script.

String habit = "predict, test, run, explain";

This introduces habit as named state for The Appropriate Programmer. Later lines can read, update, pass or print that specific value as evidence.

System.out.println(habit);

This prints habit as the observable evidence for The Appropriate Programmer. The output lets the learner check whether the programming culture idea behaved as predicted.

}

This closes the innermost The Appropriate Programmer block, so the immediately preceding method, branch or loop has finished.

}

This closes the outer The Appropriate Programmer structure, returning the reader to the surrounding class or file.

Worked example

From code to explanation

Problem: Use The Appropriate Programmer to complete a small portfolio-quality step: Write a one-page programming routine for each study session.

Method: Locate the line `String habit = "predict, test, run, explain";`, explain the exact role it plays, then decide what you would change to extend the example without changing the whole program.

Reveal worked answer

The checked run should produce `predict, test, run, explain`. A strong answer links the result back to programming culture: what was created, selected, stored, called or protected, and why that matters for the portfolio task.

Trace the program

Before: Before the key operation, identify the relevant value, object, branch or resource that the programming culture concept depends on.

During: Trace `String habit = "predict, test, run, explain";` as the The Appropriate Programmer example executes. Say whether that operation creates data, checks a condition, calls behaviour, stores information or crosses a boundary.

After: Compare the run with the expected evidence: `predict, test, run, explain`.

Change: Now keep a log of three mistakes and what they taught you, run again, and explain the smallest reason the behaviour changed.

Common misconception

A common mistake in the appropriate programmer is treating the example as a finished answer. For programming culture, the important question is narrower: which operation carries the idea, what does it make possible, and what would break if you changed it carelessly?

Quick checks

1. In this The Appropriate Programmer example, what is the best reason to focus on `String habit = "predict, test, run, explain";`?

2. Which evidence is strongest after you edit and rerun this example?

How to study this lesson

For The Appropriate Programmer, predict how programming culture changes the run before you press Run.

Use the first portfolio task as your main edit: Write a one-page programming routine for each study session.

Use the second task as your variation: Keep a log of three mistakes and what they taught you.

Finish with evidence, not a diary entry: Explain why rushing introductory code is a serious error of judgement.

Portfolio Practice

  1. Write a one-page programming routine for each study session.
  2. Keep a log of three mistakes and what they taught you.
  3. Explain why rushing introductory code is a serious error of judgement.

Final self-check

Can you explain the key operation?

Explain the line identified in the quick check in one or two sentences. Your answer should say what it does before the output predict, test, run, explain appears.

Can you justify the portfolio evidence?

Your evidence should include the original run, one edited run, and a short note explaining how the edit affected programming culture.

Study route

Practise programming culture by predicting the Java example, typing it, running it in the browser, tracing the result and saving portfolio evidence.

Next, move into Compilation and Build Feedback and carry forward one improvement from this lesson into the next program.