Jump to ratings and reviews
Rate this book

The Art of Readable Code: Simple and Practical Techniques for Writing Better Code

Rate this book
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.

204 pages, Paperback

First published September 15, 2010

110 people are currently reading
1635 people want to read

About the author

Dustin Boswell

3 books5 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
236 (30%)
4 stars
339 (44%)
3 stars
151 (19%)
2 stars
37 (4%)
1 star
4 (<1%)
Displaying 1 - 30 of 96 reviews
Profile Image for R.
258 reviews18 followers
July 12, 2018
1. Think of a variable name as a tiny comment. A good name can contain lot of information.
2. Aesthetically pleasing code is easier to read. Format your code in a consistent and meaningful way.
3. Put yourself in the reader's shoes. Think about what to comment, what not to comment and what the reader needs to know and how to convey that information in the least amount of space.
4. Instead of minimizing the number of lines, minimize the time needed for someone to understand it. Break down complex logic wherever you find.
5. Make your code easier to read by having fewer variables. Fewer variables are easier to keep track of. Remove unnecessary variables, restrict scopes and use immutable variables to make your code lightweight.
6. Refactor the generic code and unrelated sub-problems out of your code. Extract them and give a separate section for cleaner code. Make your code do only one task at a time to declutter it.
7. Describe your design in simple English. If you can't, something is probably missing.
8. Know when not to code. Keep your codebase small. Keep yourself familiar with and reuse standard libraries instead of reinventing the wheel each time. Do not overengineer.
9. Make Test code more readable. It will be easier to add more test cases in the future

The book then goes ahead and implements a "Minute/Hour Counter" using the parameters described in the book.
Worth keeping around as a reference.
Profile Image for Eduards Sizovs.
118 reviews168 followers
Read
April 24, 2020
Everything mentioned in this book has been described in great detail in Clean Code. There are absolutely no new takeaways or things to reconsider. If you've read Clean Code –skip this book. If you haven't – read Clean Code instead.
Profile Image for Brandon Miller.
133 reviews40 followers
January 11, 2018
Nice quick read with lots of ideas. I don't think you could possibly remember half of their guidelines even on the third read-through. Maybe that's just me, though.
Quite possibly the most entertaining code book, but that's more due to the chapter-heading cartoons (a few of which were surprisingly funny) more than the text itself.
One thing that was annoying was the authors' attempt to include examples from seemingly every language ever conceived. I knew the python, recognized some C, got totally lost in the javascript, and couldn't even identify some of the others. Would have been easier if they'd just picked a language and then supplemented others where necessary, instead of hopping around like a bee that can't pick a favorite flower.
Still though, some good ideas and my code will be cleaner as I move forward now that I've read it. Solid three stars in the end.
Profile Image for Gustavo Enriquez.
4 reviews1 follower
May 18, 2021
A good book for different kind of orients, either experienced or new in the software development field. The examples are consice, specific and easy to understand, and are presented in various programming languages.

All the tips and strategies presented in this book are good guidelines to write better code, however, it is up to the reader to apply them according to their needs.

I particularly liked this sentences:

"Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do"
Profile Image for Matt.
592 reviews7 followers
March 8, 2012
Good advice for the more junior developer. Maybe not the epic tome of dogmatic sledgehammery that is "Clean Code: A Handbook of Agile Software Craftsmanship", by SOLID Uncle Bob Martin.

Definitely easier to practice these tenents however. Clear, clean, approachable.

Profile Image for Temo Tchanukvadze.
54 reviews8 followers
March 1, 2020
Interesting concepts compiled into one small book about clean code. Some illustrations are funny and you won't get bored from reading guidelines. Recommended for Junior devs who've just started their journey.
2 reviews1 follower
July 15, 2014
Boswell & Foucher lay out a lot of useful tips and step-by-step examples demonstrating the “art of readable code”. While the purpose of the book is not to teach the art of architecture or design patterns, the essential basics are covered: naming variables, including comments, formatting code (e.g., column alignment, blocks, logic order, etc), simplifying loops, etc. Sure, many of these things may seem intuitive or could have been figured out on-the-job but if not, this is a great place to start. And, for those who have already mastered these practices, reiteration of the “why?” and “how?” is always a helpful reminder of what can be dismissed as common-sense or second nature.

The key idea behind the teachings is:

“The Fundamental Theorem of Readability: Code should be written to minimize the time it would take for someone else to understand it.” (3)

What I love about this book is its plethora of examples illustrating the multiple ways in which you can implement the Fundamental Theorem of Readability. Examples are provided in C++, Java, JavaScript, and Python. But fear not if you are a newbie to programming or an expert in some other language! You do not need to be proficient in any of these languages to understand the concepts being illustrated: the beautiful code “art” vs. the uglier stuff. And, if you do get lost or intimidated, each chapter is wrapped up with a summary that bullets the key principles and techniques so you will always have the takeaways in plain English.
Profile Image for Marcus Nordberg.
47 reviews
September 19, 2022
This one is a hard one to review. The ones who need to read it might not read it and those who will read it probably don’t need to read it.

Initially I found this book to be… completely redundant for anyone who worked in the industry for more than a year. It felt like it was just full of obvious advice such as “Don’t name your variable X” and I wasn’t sure I’d finish it. However, halfway through it, I was reviewing a PR at work and I realised I noticed a looot of small readability issues in the PR. And I don’t want to blame the code writer because they were all things I could have done myself. So maybe this book was giving me more value than I initially thought?

And I think the most important lesson to learn from this book is that it’s so easy to get into the habit of writing code that is readable to you - you with full context of what you’re doing. You know what ticket you’re working with, you know what code you just touched previously and you know how to implement the functionality. But who we really should target is the poor bastard who’ll take ownership of this code two years from now, the new graduate who just started in your team, or maybe even yourself in six months time when you’re trying to figure out what your past self implemented.

All in all, this book goes through the Do’s and Don’t’s and for the most part, I agree with it. The advice isn’t that controversial and I think we can all benefit from refreshing these skills every now and then. I miss functional programming though as it’s not touched upon at all (all examples are in C++ or in Python).
Profile Image for Elene Latsoshvili.
20 reviews20 followers
March 1, 2016
At first I was sceptical about reading this book, as I think there are just few rules for readable code and they are completely obvious (I am just a bit lazy to follow them). But its illustrated jokes got my attention and I ended up reading it. The rules are backed up with nice examples from real applications. It inspires to refactor and write cleaner code.
Profile Image for Rick Sam.
432 reviews153 followers
January 13, 2020
I took this book to help me establish important habits of writing code. I would recommend this to anyone whose daily work involves programming or software development.

Let me try to summarize in few paragraphs:

The fundamental theorem of code is that it is code written must be easier to understand.

To make surface level improvements in our code, we want to define variables, functions with precise words, information packed comments and formatting in such a way that readability is easy.

We want to make sure to pack enough information to be clear, precise in naming variables i.e. Kill(), Pause() instead of Stop(). At times, other programmers might misconstrue names from our programs, we want to make sure we think of other programmers and how they would interpret our code.

Comments are invaluable and should be used only when it helps in understanding the code better. We follow standard left to right value variable while using control flow and minimize as much as possible for using deep nested loops. In case of complex expressions or giant expressions, as much as we can minimize mental stack for other programmers, it is easier to maintain, code is less likely to create bugs.

As much as possible, the essential functions can be implemented from pertinent programming library so that we write less code. Each function needs to contain one task at a time and organize as much modules, functions as possible.

I have a summary of entire book, if you do want it, PM me.

Deus Vult,
Gottfried
Profile Image for Daniel Gomez Rico.
26 reviews4 followers
February 1, 2021
It's a really great book for you if you are not an experienced developer or if you are the most experience software engineer in the world, it's easy to read and filled with a lot of great patterns and knowledge that will make you just write much more better code, always warning about what will happen if you end up exagerating every advise from them, just. It should be included as material for every computer thing engineering course so people starts believing in the importance of code style as a pilar for software quality.
Profile Image for Prashob.
112 reviews23 followers
March 29, 2023
It was a pretty decent book, I won't say spectacular, I guess most of the things any developer can figure out who has 3 to 4 years of experience, still some solid nuggets here n there !
Profile Image for Juju.
124 reviews9 followers
November 26, 2021
簡單好讀,覺得讀完有提升自己對程式碼的美感。
Profile Image for Erika RS.
849 reviews259 followers
February 3, 2013
This is an excellent book that focuses on one thing and describes it well. This book is not about grand methods of software engineering or code architecture. It is, as the title indicates, about writing readable code. Boswell and Foucher cover the small things that can be done to make code easier to read, and they discuss why their suggestions generally make code more readable.

The content here is not unique. Much of it can be found in Code Complete or Clean Code. Rather, it is the narrow focus that makes this book valuable. It joins my short list of technical books that all programmers should read, even those who don't read technical books just for fun.
23 reviews2 followers
February 29, 2016
I'll be the first to admit some of the code I've written is ridiculously difficult to read. I didn't judge the quality of my code by how readable it was. "The Art of Readable Code" isn't the first book I've read that teaches the importance of writing code so that it can be read and understood. It is a good first book to read on the topic. It is well organized, taking the reader from localized concerns, such as picking good names, through structuring logic in a method, to partitioning algorithms. A case study in the last chapter brings the material together in one tangible example.
I recommend this book, especially for
1. Anyone who is new to programming.
2. Any team, newly formed or established, that doesn't have a culture that values readable code.
3. Anyone that needs a reminder about readability as a foundation of quality code.
292 reviews
February 8, 2020
Being unfamiliar with the programming languages used in the examples made this book, ironically, very difficult to read. I appreciate the high level advice but will have to find my own ways to apply it.
Profile Image for Kiril Kirilov.
110 reviews16 followers
December 15, 2015
It is from 2010, but already feels a little bit outdated. Probably needs new edition - with more functional style examples.
Profile Image for Nikolay Manolov.
2 reviews3 followers
May 30, 2016
Simple, clear, and enjoyable.
The book contains tons of nice short examples.
It revises things we have read about in "Refactoring", "Clean Code", and "Code Complete".
Profile Image for غداف.
27 reviews
June 23, 2023
رهيب كثير!
وعدنا القارئ أن يكتب خطوات عملية وسهلة لتحسين جودة قراءة أكود البرمجة، من غير إلزام كتابة الكود بلغة معينة أو بديزاين باترن معين، أو أركتكشر معين، وذكر في المقدمة أن الكتاب خفيف وممتع ما فيه تكلّف ويخلّص في أسبوع أو أسبوعين، وقد صدق وعده في كل هذا!
في كل فصل ذكر أمثلة لكود سيء أو كود مو مثالي وكيف بالخطوات المذكورة قدرنا نحسن الكود.
والأساليب يمديها تتطبق سريعا، تقرأ الكتاب من هنا ويتحسّن الكود من هنا!
ومثل أي كاتب رهيب متواضع، كتب بالملحق مقترحات كتب استفاد منها أو تكون للاستزادة.
شخصية الكاتب في نفسها رهيبة، غير خفة الأسلوب، هو شخص متواضع، ذكر في مكان أو مكانين عن اتجاهين (مدرستين) في كتابة الكود، وانتهى بعدم ترجيح أي من المدرستين وقال انت بالخيار، المحصلة بالنهاية كود سهل القراءة. يعجبني اللي يكتب عن هذا عشان يقولك أنا عارف إنه فيه خلاف هنا، لكن الخلاف هذا ما يأثر علينا وعلى مقاصد هذا الكتاب.
Profile Image for Risto Hinno.
95 reviews2 followers
March 11, 2018
Great tips and reminder of writing more readable code. Easy to follow and should be suitable for most people who can write code at some level (book is pretty much language agnostic). Quick hacks are solution for today but problem tomorrow (who doesn't have had situation when he/she doesn't understand code which he/she wrote few months ago). Writing more readable code doesn't mean you have to be a senior developer. Everybody writing code should try to make code more readable (if you work alone and nobody else sees your code (I doubt that!) you still want to understand your code after 6 months). And if you want to become a good programmer you should start practicing those tips now, only then you can become better. So read the book and implement.
Profile Image for Miguel Alho.
58 reviews10 followers
March 22, 2019
A great book and a quick read. I'm reading it with 15 years of dev-ing anda after having read Clean Code. The book goes through some things that seem obvious, but that I can notice we rasily overlook. The use of "get" in method names is one of them in my case. I think this is one of those books that can be read every so often just to keep you on track to writting good code.

It overlaps on a few topics with Clean Code and A Philosophy of Software Design, but in that sense it's worth going through them every once in a while for a refresh.

The comics in between chapters and text sections work great, too.
1 review
September 30, 2021
This book is far better than "Clean Code" despite less people knowing about it.

This book is probably the best book on writing clean code that I've ever read.

It describes the concepts clearly and diversely and is straight and to the point.

It also has very little subjectivity and dogma relative to other books, especially relative to "Clean Code" (which actually encourages many bad practices and rigidity/dogmatism of mind, contrary to popular belief).

This book is much better and less overbearing etc.
Profile Image for Sardar.
14 reviews
October 16, 2022
It is hard to pinpoint the target audience of this book.

A junior developer will probably skip it as "one of these advice books" as it is all about good advice that lacks a good story from the trenches. A seasoned developer might just nod while reading through this book as he/she probably already applies 80% of its advice in practice. This book isn't dry, yet it isn't much fun to read either.

Try Clean Code by R.C. Martin instead. Both books are about the same topic, but Uncle Bob more skillfully wraps each piece of advice in a good story from his own past.
Profile Image for Neil.
101 reviews
January 3, 2018
This book is built on the idea that a key goal for code you write should be readability, or the ease of understanding. The authors then go through a lot of different ways you can improve the readability of your code, giving examples in C++ and Python. Some of the points you'll no doubt already be following, but I suspect that just about everyone will find food for thought here. Reminds me of the Refactoring book. Only 180 pages, but packs a lot in. Recommended.
9 reviews
December 4, 2017
Essential read for a junior developer. Please be one of the good guys that writes proper code. Likely a book to revisit over the course of a few years to learn and unlearn things each time. Last few chapters are a bit fluffy and overly focused on details. Perhaps my opinion will shift when I plan to reread it in 6 months.
Profile Image for Juan Diaz.
14 reviews4 followers
September 11, 2020
This good is not bad by any means. But as a programmer with 15 years of experience I frequently thought that I already saw the principles compiled in this book.
I would day this is an excellent book of you are an student or starting in the craft, but if you want more advanced topics it will be better if you look at some of the sources used in this book.
Profile Image for Eleanor Martin.
36 reviews1 follower
September 20, 2024
Almost everything in here is very sensible, and after 20 years of writing code for a living I do most of it. I don't know if I could recommend it to some of my more junior colleagues though. There's still an element of common sense to be applied over hard and fast rules. I think I'd only want to use this as a start point for discussion.
Profile Image for Elias Daler.
31 reviews6 followers
August 20, 2017
Pretty good book.

Short and concise, full of useful advice. Most of the things are pretty obvious once you've read about them in "Code Complete" or "Clean Code", but there are still some things which will be new for the reader.
Profile Image for Marco Neves.
68 reviews7 followers
July 14, 2020
This is a really interesting collection of suggestions on how to structure code that is generally language agnostic and very well structured.

Worth the time of every developer, even if your don't agree with all of it - i agree with a good chunk of it.
Displaying 1 - 30 of 96 reviews

Can't find what you're looking for?

Get help and learn more about the design.