Ch19 Discussion

Discussion Guide

Warm-up (think–pair–share, 5 min). "Here are five FORTRAN 77 constructs — a COMMON block, an EQUIVALENCE used to inspect bits, a statement function, a computed GOTO, and REAL A(*). For each, name the modern replacement." (Exercise 19.1.) Surfaces that the mapping is mostly one-to-one — except the EQUIVALENCE, which forces the "it depends why" conversation.

Main discussion (15–20 min). 1. Why is COMMON → module the highest-value move? Draw out the Ch. 8 case-study bug: two routines disagreeing about a COMMON block silently misread memory, and the module makes it unrepresentable. Then push further (Exercise 19.23): why is it a prerequisite for parallelism, not just tidiness? (You cannot scope global COMMON state as private/shared across threads, and each coarray image gets its own copy.) 2. When does the literal translation stop being enough? Contrast CS-01 (port the trapezoid — literal translation, verify the number) with CS-02 (redesign PLATE as a field_t library). When do you invest the extra design, and when do you stop at the safe literal move? (Load-bearing, growing, multi-instance code earns the library; throwaway scripts do not.) 3. The dropped clause. Put Exercise 19.12 on the board: a do while (diff > tol) that lost the iteration cap. Ask what real-world input triggers the infinite loop (a non-converging configuration, a tolerance below achievable precision). Teaches "translate every clause of a compound condition" — and that the cap is a safety feature, not bookkeeping.

Group activity (10 min). In pairs, hand out code/plate-legacy.f. Each pair produces the "parts list" of CS-01's Phase 1 for PLATE: every legacy construct, the dictionary entry, the modern replacement — on paper, no coding. Then each pair states the one hand-checkable number that proves their (hypothetical) modernization preserved the physics (Ch. 18's 37.5/12.5 interior). Collect and compare parts lists: did everyone catch the assumed-size PRTROW, the statement function, and both COMMON blocks?

Exit ticket. "Name the one translation in this chapter that is a correctness fix (not just style), and give the two-line bug it prevents." (Expected: implicit none — it turns a mistyped variable name, which implicit typing would silently make a new garbage variable, into a compile error. Exercise 19.18 is the canonical instance.)