選択できるのは25トピックまでです。
トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
The Psychology of Computer Programming — Chapter 01: Reading Programs
- Date Created: 2026-10-23
- Status: Complete
- Reading Span: PDF pages 31-42
1. Pre-Reading Briefing
- Core Question: What can reading a program reveal about programming as a human activity that running or evaluating its output cannot?
- Key Points to Watch For:
- The difference Weinberg draws between executing code and reading it as a human-created text.
- His diagnostic question for each fragment of code: why is this piece here?
- The different sources of code structure he asks the reader to distinguish: machine, language, programmer, history, and specification.
- The way technical artifacts preserve earlier constraints, decisions, and organizational circumstances.
- What code review contributes to learning—and what makes programmers resist it.
- Context & Thread from Prior Chapters: First chapter — nothing carried in.
2. Reading Review & Reflections
- Prompt Questions:
- In your own words, what can reading a program reveal about programming and its creators that merely running the program cannot?
- Imagine you encounter a puzzling or apparently unnecessary fragment in an older codebase. How would you investigate whether it comes from a machine constraint, language constraint, programmer limitation, historical trace, or specification?
- Which of those influences do you think most often misleads maintainers in modern software, and why?
- User Key Takeaways:
- “Why somthing was done in a certain way”
- “youll need context of the issue and the machine it was used on”
- “programmer limitation”
- Scaffolding & Feedback: The reader identified the chapter's central purpose: reading code exposes why it took its present form. The instinct to seek context is correct, but the relevant context also includes the language and version, original specification, change history, and people—not only the issue and machine. Programmer limitation is a defensible modern concern, but strange-looking code should not be attributed to incompetence until vanished technical or historical constraints have been ruled out.
- Follow-Up Question: What evidence would help distinguish a programmer limitation from a historical workaround that was reasonable when it was written?
- Follow-Up Answer: “not sure but comments in the code and an understanding of what the progrm does helps”
- Follow-Up Feedback: Comments and an understanding of behavior are useful evidence. Because comments can be incomplete or stale, corroborate them with version-control history, old requirements and issue records, tests, platform or language documentation from the period, and—when available—the original contributors. A programmer limitation becomes more likely only after showing that a simpler valid option existed at the time and the author apparently did not recognize it.
3. Chapter Synthesis
- Core Thesis: Reading code as a human artifact reveals that its form comes from intertwined machine, language, programmer, historical, and specification forces—not simply from the problem it appears to solve.
- Key Concepts / Mental Models:
- Programs as readable artifacts: Code is not merely input for a machine; it is a form of human writing from which programmers can learn by studying both strong and weak examples.
- The causal reading question: Ask, “Why is this piece here?” The question shifts attention from what code executes to the circumstances that produced it.
- Five sources of code structure: A fragment may reflect a machine constraint, language constraint, programmer limitation, historical trace, or specification. These causes can overlap.
- Code archaeology: Apparently irrational code may be the surviving residue of a once-rational workaround. Recover its original context before judging or removing it.
- Specifications as evolving knowledge: Implementation is not always the mechanical execution of a fixed specification; the program, programmer, and understanding of the desired result can develop together.
- Review as deliberate practice: Reading and discussing other people's code builds judgment, but its value depends on learning to distinguish good solutions from merely familiar ones.
- Notable Arguments & Evidence:
- Weinberg repeatedly simplifies a small PL/I summation program by removing storage limits, language restrictions, and gaps in programmer knowledge. The exercise demonstrates that much of a program can encode its environment rather than its essential task (PDF pp. 31–39).
- A Social Security routine converted an unexpected
A to 1 because an old keypunch had once produced that error. The temporary repair survived long after new validation made it appear pointless, illustrating how historical traces become maintenance puzzles (PDF pp. 37–38).
- Weinberg argues that specifications and programs often co-evolve because implementation teaches both developer and client what is actually wanted (PDF p. 38).
- In the Silver Anniversary comments, he maintains that program reading and technical review remain essential while warning that maintainers often encounter poor examples and accumulated historical residue (PDF p. 41).
- Evidence limits: The chapter is built mainly from professional observation and illustrative anecdotes, with examples tied to older hardware and PL/I/FORTRAN. The causal categories remain useful, but claims about prevalence should not be treated as modern quantitative evidence without validation.
- Updates to Prior Understanding: As the opening chapter, this establishes the book's baseline lens: software should be examined not only as logic but also as evidence of human decisions made under particular technical and social conditions. The reader's instinct to use comments and observed behavior is useful, with the added safeguard that both should be corroborated before attributing strange code to programmer limitation.
- Weekly Action Item: Choose one old or unfamiliar function. For each puzzling fragment, record its probable origin—machine, language, programmer, history, or specification—and the evidence supporting that classification. Check comments against version history, tests, requirements, and period-specific documentation before refactoring.