Module 3: Code Readability Basics
Primary teacher: this guide
Selective supporting text: Clean Code (Robert C. Martin)
This is a small orientation module, not the complete Clean Code course. It establishes habits that a beginning programmer can apply immediately: reveal intent with names, keep functions honest, use comments for context rather than narration, format code for reading, and protect behavior with basic tests.
The complete book and the deeper questions about object design, system boundaries, refactoring strategy, and review heuristics belong to Semester 3: Software Design & Patterns. On the full-book path, read Clean Code there, after Good Code, Bad Code, and read it critically rather than as unquestionable law.
Required Scope
Work through these concepts in order.
Readability Foundations
| Order | Concept | Focus |
|---|---|---|
| 1 | Clean Code Is a Change Strategy | Why readability lowers the cost of future changes |
| 2 | Names Carry Design Intent | Intention-revealing names and honest distinctions |
| 3 | Comments Are a Last Resort | When comments help and when clearer code is better |
| 4 | Formatting Shapes How Code Is Read | Layout as communication rather than decoration |
Honest Functions and Basic Tests
| Order | Concept | Focus |
|---|---|---|
| 5 | Functions Should Do One Thing | Single purpose and one level of abstraction |
| 6 | Arguments and Side Effects Must Be Honest | Inputs, mutation, and unsurprising behavior |
| 7 | Tests Enable Design Change | Tests as protection for small structural changes |
| 8 | Tests Should Read Like Explanations | Clear test names and one behavior per test |
Then complete these practice pages:
Use the module quiz after the required concepts and practice. The exercise lanes, learning resources, and selective reading map are optional support when the guide is not enough.
Deferred to Semester 3
Semester 0 deliberately does not require:
- error-handling and third-party boundary design
- emergent design rules and broader duplication tradeoffs
- object/data distinctions, cohesion, SOLID, and class responsibility
- system seams and dependency control
- formal refactoring workflows, smell catalogs, and full code-review heuristics
- front-to-back reading of Clean Code
Semester 3 teaches those ideas with stronger prerequisites and compares Clean Code against Refactoring, Good Code, Bad Code, OOAD, and the design-pattern texts.
Learning Objectives
By the end of this module you should be able to:
- Explain how readability affects the cost and risk of change.
- Improve names, comments, and formatting with a concrete reason for each change.
- Refactor a small function so its purpose, inputs, and side effects are clear.
- Write basic behavior tests that make a small refactor safer.
Outputs
- one readability audit of an existing file
- one small function refactored in verified steps
- one small behavior-focused test suite
- one short before/after note explaining what became easier to understand
Completion Standard
You are done when you can improve a small piece of code without relying on vague claims such as “this looks cleaner,” and your tests demonstrate that its behavior stayed intact.
Suggested Flow
| Session | Work |
|---|---|
| 1 | Concepts 1-4 and a readability audit |
| 2 | Concepts 5-6 and a function-level refactor |
| 3 | Concepts 7-8, behavior tests, and the module quiz |
Rich Learning Pages
Worked Examples | Guided Labs | Case Studies | Mistake Clinic | Reading Guide | Capstone Thread