Art of Readable Code 平装 – 2011年11月15日
Dustin Boswell realized he was not destined to follow in his father's footsteps as a trapeze artist, so he turned to computer programming at a very early age. As a teaching assistant in graduate school, he graded many projects with unreadable code, and wished he could hand the students a book to help them out. After receiving his master's degree he joined Google, where he spends his working hours on web crawling and AdSense Ads. On the side he spends his time traveling, playing video and strategy board games, and obsessing over making code more readable. Dustin received his BS degree from Cal Tech, and his master's degree in Computer Science from the University of California, San Diego. 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, and he's worked his whole career on making code more readable and reliable. While at Google, he has spoken at various conferences and training sessions across the country to help teach people how to use Google's services to make websites more user- and Google-friendly. In his spare time, he attends gaming conventions, reads science fiction, and serves as COO of his wife's fashion start-up company. Trevor graduated with a BS degree in Electrical Engineering and Computer Science from the University of California, Berkeley.
|5 星 (0%)|
|4 星 (0%)|
|3 星 (0%)|
|2 星 (0%)|
|1 星 (0%)|
Along comes "The Art of Readable Code". The authors have written a very enjoyable, highly readable book about readability. They go beyond simply stating a set of guidelines, instead explaining the motivation behind each suggestion. I love that they show both good and bad from-the-field examples of how programmers write code. I found myself nodding in agreement with much of what they said. I also think they do a much better job than I when it comes to explaining that readable code is not simply a set of requirements to follow, but that there are simple compelling reasons behind readability, not the least of which is to make life easier for others who will read your code.
I have decided that I will begin making this a required reference for my students. Our school subscribes to Safari Online Books, which gives our students free access to O'Reilly books such as this one. Even if my students couldn't get it for free, I think it's a book I would want our computer science/software engineering majors to have handy as a reference. I bought the Kindle edition for myself, and found that it is very readable on the Kindle Fire...and much more relaxing to read this way than from the Safari site (and currently only about half the cost of buying the physical book).
From now on, I will let this book deliver the message to my students about readable code.
As an engineer I find that many of the tips are applicable outside of programming, too. Following the type of organization and common sense set forth by the authors in, say, a 600-part parametric CAD model, will also do wonders to productivity.
I don't think this book will ring any bells for someone just starting out. If only we had the foresight, right? But anyone who is "self taught" should go through this; they'll surely find tips to avoid problems they've previously created for themselves.
Every scientist should read this book. They tend to write the worst imaginable code. They "just want it to work" and they test this and that and leave code with patches like "if(1 == 1)" and variable names like "flag". Then when things "get serious" you have to pay thousands to get someone to not only rewrite the code, but also re-interpret the functionality.
But I've found many useful tips.
The book is great, reads very well.