The Art of Readable Code - Dustin Boswell

The Art of Readable Code

Dustin Boswell

出版时间

2011-10-08

ISBN

9780596802295

评分

★★★★★

标签

编程

书籍介绍

As programmers, we've all seen source code that's so ugly and buggy it makes our brain ache. And let's be honest, we've all written code like that. With this book, you'll learn to write code that's easy to read and understand. You'll have more fun and your coworkers will love you.

The Art of Coding focuses on the nuts and bolts of programming, with simple and practical techniques you can use every time you sit down to write code. You'll find tips throughout the book, with easy-to-digest code examples, helpful illustrations, and cartoons for fun.

* Learn to pick variable names that are "dense with information"

* Organize your loops and conditionals so they're easy to understand

* Make your comments short and sweet

* Recognize when your code is doing too many things at once

* Write tests that are concise, but thorough

* Master the art of breaking hard problems into many smaller ones

AI导读
核心看点
  • 提出可读性基本定理:代码应最小化他人理解时间
  • 提供变量命名、循环组织等实用技巧,提升代码清晰度
  • 强调测试代码也需可读,便于后续维护与修改
适合谁读
  • 希望提升代码质量、追求优雅编程的初级至中级开发者
  • 经常进行代码审查,需快速理解他人逻辑的工程师
  • 对Clean Code感兴趣,但偏好更轻量、实战导向的读者
读前提醒
  • 本书篇幅短小,适合利用碎片时间轻松阅读,无阅读压力
  • 书中包含幽默漫画与实例,建议结合日常编码实践对照阅读
  • 若已深读Clean Code,可重点参考本书在注释观点上的差异
读者共识
  • 内容短小精悍,案例源自实战,阅读体验轻松愉快
  • 被公认为讲解代码可读性最优秀、最生动的入门书籍
  • 虽深度不及大部头,但细节建议极具价值,物超所值

本导读基于书籍简介、目录、原文摘录、短评和书评生成,不等同于全文精读。

精彩摘录
  • "找到更有表现力的词 send -> deliver, dispatch, announce, distribute, route find -> search, extract, locate, recover start -> launch, create, begin, open make -> create, set up, build, generate, compose, add, new"
  • "Names like i, j, iter, and it are commonly used as indices and loop iterators. Even though these names are generic, they’re understood to mean “I am an iterator.” (In fact, if you used one of these names for some other purpose, it would be confusing—so don’t do that!) But sometimes there are better "
  • "The goal of this book is help you make your code better."
  • "Keeping Your Codebase Small"
  • "Finding More "Colorful" Words"
  • "Values with Units"
  • "Test code should be readable so that other coders are comfortable changing or adding tests."
  • "Creating the Minimal Test Statement"
作者简介
Dustin Boswell Although raised in the circus, Dustin Boswell realized early on that he was better at computers than at acrobatics. Dustin received his B.S. from CalTech, where he got hooked on Computer Science, and then went to UC San Diego for his Master's Degree. He worked at Google for five years, on a variety of projects including web crawling infrastructure. Dustin is now an internet startup junkie who spends his free time hiking the Santa Monica mountains and being a new dad. Trevor Foucher has been shipping software projects for over 10 years, including Windows 2000 and OneCare at Microsoft, and Webmaster Tools at Google. He's been an individual contributor, manager, and tech lead. His goal is to make code more readable and reliable.
目录
Dustin Boswell turned to computer programming at a very early age. After receiving his master's degree he joined Google, where he spends his working hours on web crawling and AdSense Ads.
Trevor Foucher has been shipping software projects for over 10 years, including Windows 2000 and OneCare at Microsoft, and Webmaster Tools at Google. He's been an individual contributor, manager, and tech lead. His goal is to make code more readable and reliable.
用户评论
这本书的Further Reading里列出来的书里有Code Complete, Clean Code, Refactor, The Practice of Programming, 如果读过其中的任何一本, 都会觉得这本书没有什么新的内容 ... 嗯 每一节开头的漫画很赞 ... 最后一章是一个从烂到赞的重构过程, 嗯, 读起来很晕 ...
漂亮的出版社、封面、书名、以及插图,所触基本为函数级别或以下的代码,清晰易懂,可惜鲜见前人肩膀之后更新或更深的阐述,Further Reading值得细看。
篇幅小内容有价值适合上下班阅读。
轻松愉快
里面还提到了对测试代码的可读性介绍,书里的漫画配得不错。
命名备注这些经常在写代码里被忽略的东西确实很重要。以前总以为代码行数少就很自豪,工作了发现代码写的让人看懂让自己在之后看懂更重要。这书很好读对很多基本的概念解释地不错。同事写的必须给个满星👍
这本书标注了六七年终于这星期抽空看掉了,每天一到两小时30页,一周看完。需要编程经验,不适合新手。最后的推荐阅读书目很有意思,基本是软件工程必读著作,还主动把自己和 Clean Code 对比了一下。看完这个 Clean Code 基本不用看 - Clean Code 使用的是 Java 所以多出来的部分是 error handling 和 cocurrency 的东西。而本书针对的是泛化的编程语言,例子里用得最多的是 C++,其次是 JavaScript 和 Python。
Uncle Bob 的经典之作
很有实践性的经验之谈,看完可以直接看Martin Fowler的Refactoring。
It deserves to read again
收藏