Ch02 Discussion

Discussion Guide

Warm-up (think–pair–share, 5 min). "What is the difference between what the compiler does and what the linker does?" Let pairs struggle, then converge on: compiler translates one source file to an object; linker stitches objects and libraries into a runnable executable. Surfaces the pipeline model before you formalize it.

Main discussion (15–20 min). 1. Read the error, name the stage. Put three error messages on the board — a "has no IMPLICIT type", an "undefined reference to …", and an "Expecting END PROGRAM statement". For each, have the class call out compile-stage or link-stage and propose a fix. This is the single most transferable skill in the chapter. 2. The silent-bug post-mortem. Walk Case Study 1: the converter compiles, runs, and prints 32 instead of 212. Ask "what finally caught this — the compiler, the run-time checks, or the human?" Draw out that only the hand-computed expected answer caught it, which is why the book computes outputs by hand. 3. Flags as a tradeoff. "Why not just always compile with -fcheck=all? Why not never?" Elicit the develop-vs-release tradeoff and the rule about never timing a checked build.

Group activity (10 min). In pairs, each student writes and compiles a program that deliberately fails — one with a compile-stage error and one with a link-stage error (hint for the latter: call a subroutine that doesn't exist) — then swaps with their partner, who must name the stage from the message alone. Fast, hands-on, and it makes the compile/link distinction concrete.

Exit ticket. "In one sentence, what disaster does implicit none prevent, and where in a program unit does it go?" (Checks the §2.6 core: it turns a mistyped variable name from a silent wrong answer into a compile-time error, and it goes immediately after the opening line, before the declarations.)