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 hands-on field guide to writing code that other humans can read, change, and trust—built around Robert C. Martin's principle that clean code is a matter of professional discipline, not talent. Best for working programmers, reviewers, and tech leads who want concrete rules plus full refactoring walkthroughs rather than abstract theory.
【Book Arc】
- **Opening (~0%–12%)**: Frames the whole argument—why code never disappears, how messy code quietly kills products and companies, and why "keeping code clean" is the only way to actually go fast. Introduces the Boy Scout Rule and the "code sense" the rest of the book trains.
- **Early (~12%–35%)**: The rulebook chapters: meaningful names, small single-purpose functions, honest comments (and why most comments are failures), consistent formatting, and the asymmetry between objects and data structures. This is the vocabulary layer you apply everywhere else.
- **Middle (~35%–55%)**: Error handling, boundaries with third-party code, unit tests and the F.I.R.S.T. criteria, and class design around cohesion and the Single Responsibility Principle. Shifts from naming-level hygiene to structural design decisions.
- **Late (~55%–80%)**: Systems, emergent design, and concurrency—separating construction from use, dependency injection, the simple design rules, and why thread code is hard to get right and hard to test. The most technically demanding conceptual stretch.
- **Ending (~80%–100%)**: Three extended case studies (Args, JUnit internals, refactoring SerialDate) plus the "smells and heuristics" catalog. This is where principles become decisions you can watch being made, mistake by mistake.
【Key Takeaways】
- **Clean code is an economic argument, not an aesthetic one** (Opening): Martin's core claim is that mess slows you down immediately, so the only way to hit deadlines is to stay clean—this reframes tidiness as self-interest rather than virtue.
- **Names carry the design** (Early): A name should answer why it exists, what it does, and how it's used; if it needs a comment, it's the wrong name. The minesweeper example shows renaming alone can make obscure code self-explanatory.
- **Functions should be small and do one thing** (Early): One abstraction level per function, few arguments, no side effects, and exceptions instead of error codes. These rules compound—small functions make small classes possible.
- **Most comments are apologies for bad code** (Early): Good comments explain intent, warn, or document public APIs; bad ones mumble, mislead, or preserve dead code. Prefer expressing meaning in code over explaining it beside code.
- **Tests are part of cleanliness, not an extra** (Middle): Untested code is unclean no matter how elegant; the F.I.R.S.T. criteria and one-assertion-per-test guidance make tests maintainable rather than disposable.
- **Classes earn their keep through cohesion** (Middle): Keep classes small, let cohesion drive splitting, and organize around change—the SRP is presented as the practical lever for both.
- **Concurrency is a discipline with its own failure modes** (Late): Limit shared data, keep synchronized regions tiny, make threads independent, and treat flaky failures as thread bugs. The excerpts note correct shutdown code is genuinely hard.
- **Refactoring is continuous, not a phase** (Ending): The case studies demonstrate incremental improvement—make it work, then make it right—and the smells catalog turns those lessons into a reusable checklist.
【Reading Tips】
- Read Part 1 (naming through classes) closely and slowly; it's dense with rules you'll apply daily, and skimming it defeats the purpose.
- Treat the case-study chapters as the real book. Martin explicitly warns that skipping them reduces everything to a "feel-good" book—follow the bracketed heuristic references as you go.
- Keep the smells-and-heuristics chapter as a reference to revisit after you've struggled with the case studies, not as a first read.
- The concurrency material is the hardest stretch; if threads aren't your daily work, read it for principles and return when you actually write concurrent code.
- Expect Java-centric examples throughout; translate the reasoning to your own language rather than looking for direct syntax equivalents.
【Coverage Limits】
The excerpts cover the full table of contents and substantial front matter, naming, and framing chapters, but detailed content from the later case studies, concurrency appendix, and smells catalog is only partially represented here.
o forgive, divine)。在Scrum中,我们使一切可见。我们晾出脏衣服。我们坦承代码状态,因为它永不完美。我们日渐成为完整的人,配得起神的眷顾,也越来越接近细节中的伟大之处。 在自己的专业领域中,我们亟需能得到的一切帮助。假使干净的地板能减少事故发生,假使归置到位的工具能提升生产力,我也会倾力做到。...
ee e, Date date), 或 deliverPay(Employee e, Money pay), 如此等等。它们的结构都有同样的问题。 该问题的解决方案(如代码清单3-5所示)是将switch语句埋到抽象工厂 [9] 底下,不让任何人看到。该工厂使用switch语句为Employee的派生物创建适当的...
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
代码整洁之道 (马丁(Robert C. Martin))(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 to WeChat Moments
代码整洁之道 (马丁(Robert C. Martin))(Z-Library)
Scan the QR code with WeChat to open this book
Tap the ··· menu in the top-right corner
Choose Share to Moments
You are already in WeChat. Tap ··· in the top-right corner and choose Share to Moments.
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
代码整洁之道 (马丁(Robert C. Martin))(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