Messy code is a nuisance. “Tidying” code, to make it more readable, requires breaking it up into manageable sections. In this practical guide, author Kent Beck, creator of Extreme Programming and pioneer of software patterns, suggests when and where you might apply tidyings to improve your code while keeping the overall structure of the system in mind.
Instead of trying to master tidying all at once, this book lets you try out a few examples that make sense for your problem. If you have a big function containing many lines of code, you’ll learn how to logically divide it into smaller chunks. Along the way, you’ll learn the theory behind software design: coupling, cohesion, discounted cash flows, and optionality.
This book helps you:
• Understand the basic theory of how software design works and the forces that act on it
• Explore the difference between changes to a system’s behavior and changes to its structure
• Improve your programming experience by sometimes tidying first and sometimes tidying after
• Learn how to make large changes in small, safe steps
• Approach software design as an exercise in human relationships
Kent Beck, creator of Extreme Programming, is a pioneer of software patterns, coauthor of JUnit, rediscoverer of Test-Driven Development, and observer of 3X: Explore/Expand/ Extract. Alphabetically, he’s the first signatory of the Agile Manifesto. Kent lives in San Francisco, California, and he is Chief Scientist at Mechanical Orchard, teaching skills to help geeks feel safe in the world.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A practical, philosophy-driven guide to improving code readability through small, safe structural changes ("tidyings") before or after behavior changes, ideal for working programmers who want to make large changes incrementally without a heavy design process.
【Book Arc】
- **Opening (~0%–9%)**: Introduces the core problem—messy code hinders change—and the central concept of "tidying" as small structural improvements. The foreword establishes the theoretical foundation: coupling and cohesion as measures of human comprehension, not machine efficiency.
- **Early (~9%–25%)**: Lays out the first set of concrete tidyings, starting with guard clauses and dead code removal. Emphasizes the "tiny steps" principle and introduces the empirical design stance: design when you can take advantage of it, not speculatively or reactively.
- **Early–Middle (~25%–38%)**: Continues the catalog of tidyings—new interface/old implementation, reading order, cohesion order, explaining variables/constants, explicit parameters. Each is presented as a micro-decision that reduces cognitive load and prepares code for change.
- **Middle (~38%–47%)**: Covers chunking statements and the counterintuitive "mooshing" (lumping code together) when small pieces create confusion. Introduces the crucial distinction between behavior changes (B) and structure changes (S), and the practice of separating them into different PRs.
- **Late (~47%+)**: Synthesizes the tidyings into sequences and flows, showing how small structural moves compound into easier behavior changes. The book closes by framing software design as an exercise in human relationships and judgment, not just technique.
【Key Takeaways】
- **Tidying is structural, not behavioral** (Early): A tidying changes how code looks and reads but never what it does. This distinction lets you make safe, reversible improvements without risking functionality—separate tidying commits from behavior-change commits.
- **Coupling and cohesion are about human brains, not machines** (Opening): Code is easier to understand when related pieces hang together (cohesion) and when connections between pieces are few and weak (coupling). This is the theoretical lens for all tidyings.
- **Design timing is empirical, not speculative** (Early): Design "somewhere in the middle"—when you observe a class of features is hard to add, design until the pressure is relieved. This requires taste and judgment, not rigid rules.
- **Tiny steps compound** (Early): Always take small, safe steps. A guard clause or a blank line may seem trivial, but software design enables more software design—compound interest works for code structure too.
- **Reading order is a gift to the next reader** (Early): Reorder code in the sequence a reader would prefer to encounter it. You are the reader; use your recent experience to decide. Don't mix other tidyings into the same pass.
- **Cohesion order beats decoupling when decoupling is too costly** (Early): If you can't eliminate coupling (intellectual, time, or relationship constraints), at least move coupled elements adjacent. This makes behavior changes easier without a big refactor.
- **Explicit parameters improve testability and clarity** (Middle): Split routines to pass data explicitly rather than via maps or environment variables. This makes code easier to read, test, and analyze—and prepares it for future changes.
- **Separate tidying from behavior in version control** (Middle): Put tidyings in one PR and behavior changes in another. Reviewers will balk at mixed changes; separating them makes each review clearer and each change safer.
【Reading Tips】
- **Skim the table of contents and pick tidyings relevant to your current pain** (Early): The book is designed for non-linear reading—try a few examples that match your problem rather than reading cover-to-cover.
- **Deep-read the theory sections (foreword, preface, and Part II)**: These explain *why* tidying works (coupling, cohesion, empirical design) and are essential for internalizing the approach, not just copying techniques.
- **Practice each tidying on real code as you read**: The examples are simple, but the value comes from applying them. Start with guard clauses and chunking statements—the easiest wins.
- **Watch for the "mooshing" counterintuitive move** (Middle): When small pieces create confusion, lumping code together is legitimate. Don't skip this chapter; it prevents dogmatic over-splitting.
- **Take away the PR-separation habit** (Middle): Even if you don't adopt all tidyings, separating structural from behavioral changes in version control is a universally valuable practice.
【Coverage Limits】
The excerpts cover the tidyings catalog and the early theory, but do not include the full Part II discussion of sequences, coupling power laws, or the later chapters on human relationships and economics (discounted cash flows, optionality). The guide focuses on the practical tidyings and the behavior/structure distinction.
Page 3
This book helps to move the focus in software away from the tools and technology, and firmly onto what really matters, design! Design is about the shapes we ...
y too large for a book. Take a tiny, too-small slice. Write. Discover the slice is too large. Repeat. And so here you hold (virtually or for real) the first ...
an increase cohesion enough to make behavior changes easier. Sometimes the increased clarity from slightly better cohesion unlocks whatever is blocking you f...
ing the structure of the program. Those changes can only be observed by looking at the code: B=behavior, S=structure (Figure 16-2). Figure 16-2. Behavior cha...
anyway (good for you—mess is no excuse). But now, huzzah!, you see how the change you made could have been easier. Do you tidy after? It depends. Are you eve...
row, it’s worth less than the dollar I give you today. Why? • You can’t spend it, so it’s worth less. • You can’t invest it, so when you get it, it will be w...
s equal? Of course not, not if I ask the question like that. We can bump along making small changes to the behav‐ ior of the system, all of them costing abou...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Tidy First A Personal Exercise in Empirical Software Design (Kent Beck)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Tidy First A Personal Exercise in Empirical Software Design (Kent Beck)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment