As programmers, we’ve all seen source code that’s so ugly and buggy it makes our brain ache. Over the past five years, authors Dustin Boswell and Trevor Foucher have analyzed hundreds of examples of "bad code" (much of it their own) to determine why they’re bad and how they could be improved. Their conclusion? You need to write code that minimizes the time it would take someone else to understand it—even if that someone else is you.
This book focuses on basic principles and practical techniques you can apply every time you write code. Using easy-to-digest code examples from different languages, each chapter dives into a different aspect of coding, and demonstrates how you can make your code easy to understand.
- Simplify naming, commenting, and formatting with tips that apply to every line of code
- Refine your program’s loops, logic, and variables to reduce complexity and confusion
- Attack problems at the function level, such as reorganizing blocks of code to do one task at a time
- Write effective test code that is thorough and concise—as well as readable
"Being aware of how the code you create affects those who look at it later is an important part of developing software. The authors did a great job in taking you through the different aspects of this challenge, explaining the details with instructive examples."
—Michael Hunger, passionate Software Developer
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.