It's been a while since my last book review, but lately I was reading non technical ones. I'm again reading a lot of tech stuff so here comes the last review of the year but first of a bunch I would like to post in the following weeks.
Title: The Art of Readable Code
Author: Dustin Boswell, Trevor Foucher
We as engineers tend to code for ourselves, but the truth is that most of the time our code should be legible and easy understandable by others. And this is what this book is about, about writing good code in the sense of easy to read and understand.
With some really good advices and typical discussions like for example:
- Minimize time taken to understand it.
- Consistent style is more important than "right” style.
- Don't comment bad names, fix the names
- Ternary operator usage
- Yoda conditionals
- Single return per function vs multiple ones...
- Build general purpose and reusable code (because this implies decoupled code)
Many typical coding standard situations that you will either have already faced or will face sooner or later when working in companies.
How to properly do tests, advices on cleaning code, refactoring, keeping the codebase small, doing reusable and generic components instead of especializations...
Nice examples all along the book, really well chosen.
The book is an easy and fast read, and for me should be mandatory no matter the language you develop with.