Through my Ruby and Rails journey, I’ve discovered a few excellent Ruby books that I’d like to share with fellow Rubyists. The authors of these books are experts in their fields. These books are my recommendation and I think they deserve some space on your desk.
By the way, having “intermediate” in the title means nothing, anyone can benefit in some form from these books. I try to pick a single audience to write for hence the title. In the coming days, I’ll create a booklist targeting entry-level and more experienced Ruby and Rails developers. Feel free to follow me on Twitter to stay in the loop.
In no particular order, here are four books I think are worth your time and money.
Metaprogramming Ruby 2
I’m not sure how much of an exaggeration it’d be if I say DSL or framework code will make little to no sense to you if you haven’t read this book, at least this is how I felt unless you’re Matz or Aaron Patterson. I got this book recommendation from Richard Schneeman and finished it in a week, it’s that good.
This book reveals how all the magic in DSLs is performed. Don’t be fooled by the publication date, this book is as relevant as a parachute is to skydiving. Paolo Perrotta is a talented writer and knows how to hold attention.
It will teach you how to be a magician, you’ll learn metaprogramming skills that’ll help you understand any DSL. It shows you how to write and understand practical metaprogramming code with countless examples.
Sustainable Web Development with Rails
Sustainable Web Development with Ruby on Rails is a book I found by chance, took the risk and purchased when it wasn’t even completed. I watched how David Copeland iterated until completion, no regrets to this day. The book gets updates when needed if you have the digital version. David is the co-author of Agile Web Development with Rails 6 and has extensive experience in engineering software.
It covers the entire MVC architectural pattern in Rails with extras. You’ll learn stuff like what happens when a job fails, to productive workflows and processes during development. It’ll teach you how to build or start a Rails project that’s maintainable and how to rid your application of chaff. If you’re a professional Rails developer, you’ll learn even more skills to add to your arsenal.
Rails is nothing more than a fancy Rack application, to understand Rails, you need to know how Rack works and that’s when Noah Gibbs comes in with Rebuilding Rails. Noah will enlighten you not only on how Rails is built but also teach you even more metaprogramming if you didn’t get enough from Paolo Perrotta.
Noah is an expert Ruby Performance guy, if you fancy advanced Ruby and Rails stuff, I recommend checking out his blog. Thank me later.
By reading this book and coding along, you’ll understand the source code of Rails as well as that of other Rack-based frameworks, this includes among others, Sinatra and Hanami. The source code of any Rack-based web framework will be intelligible, that’s an unofficial guarantee.
Polished Ruby Programming
You know that feeling when after reading too many beginner books, you go like “isn’t there something more advanced on Ruby? A book that won’t overwhelm me, but also a Ruby book that’s not too advanced?”. Several years ago, for a long time, I got bored of reading beginner Ruby books, I wanted something more, something that’d let me understand Ruby’s philosophy just enough to design better code. Well, Jeremy Evans has your back.
Jeremy contributes a lot to open source, Ruby and Rack included. He’s the author of Roda and Sequel and several other open-source software. His style of writing Ruby is very different – In my books, he’s the epitome of defensive programming. There’s an opportunity to learn directly from Jeremy through Polished Ruby Programming.
Polished Ruby Programming, as well as all the other books, have clear descriptions of what exactly you’ll learn. I won’t repeat them but will encourage you to check the books’ contents, and for some, download sample chapters.
Mind you though, that depending on how much exposure you have already with Ruby, this book might be a bit advanced.
Practical Object-Oriented Design
I know… the title reads “4 books” but here’s another book because this blog post is OBO.
Now, I’m sure you know this title, and probably read it already. It’s a classic. Most Rubyists I know have read it. You’ll learn the fundamental tenets of OOP with topics like building objects via composition and how to be a professional duck typer.
In the Ruby community, Sandi Metz is one of the authorities on object-oriented programming. I like this book and want it to be on my list of recommendations. So let’s keep it here.
I may have missed some good titles that didn’t make it onto my list. What Ruby or Rails books would you recommend?