Chunking groups detailed operations into meaningful higher-level units. In code, readers use chunks to recognize intent—such as validating input or storing a user—instead of processing every statement separately. section 2.3.2
From mechanics to a readable story
A literal sequence of field checks and database operations makes readers reconstruct the structure themselves. Clear methods such as validateMandatoryField, validateBirthDate, validateEmail, and saveUser expose four meaningful steps, making the missing first-name validation visible. section 2.3.3
Use chunking to reduce cognitive load while preserving important behavior.
- Group strongly associated operations into one recognizable unit. section 2.3.2
- Hide low-level mechanics behind methods whose names communicate their purpose. section 2.3.3
- Keep the top-level sequence short enough that readers can follow the plot and notice omissions or bugs. section 2.3.3
Figure 2.1 Chunking: How our brain groups code
Use the figure to see how readers group detailed code into larger conceptual units. section 2.3.2
Listing 2.2 A simple story
public User createUser(
String firstName,
String lastName,
String email,
LocalDate birthDate,
String city) throws UserRegistrationException {
validateMandatoryField(lastName, "Last name");
validateBirthDate(birthDate);
validateEmail(email);
return saveUser(firstName, lastName, email, birthDate, city);
}
Use the listing as a compact example of a method whose named operations form a readable narrative. section 2.3.3


















