A List of Books to Learn Programming with Ruby and Rails
This post provides a curated list of books to learn to code in Ruby and build web applications with Rails. It also gives a step-by-step path you can follow to learn enough before moving to the next step. If you ever wanted to learn to program but didn't know where to start, this post is for you.
Ever since I started writing about Ruby and Rails on this blog, I’ve received dozens of emails and messages from students, programmers, and non-software professionals on how to get into programming and start learning Ruby on Rails to build web applications.
After replying to a lot of these queries both in person and online on various forums and emails, I decided to save some keystrokes and compile everything into a blog post that I could point to and keep updated.
What follows is a curated collection of books to learn to program in Ruby and build web applications using Rails. Each section provides a path that you can follow to learn enough before moving to the next section.
This post only covers books. Could you learn by watching YouTube, screencasts, or online courses? Probably, but reading books is how I learned Ruby and Rails, and it's the best way I know how to learn anything. So books it is. If you know other material, please mention them in a comment below.
Now, if you haven't programmed before, you might have two questions:
Why Ruby? The simple answer is: it's easy and it's fun. That's it. If you were turned off from programming because you learned Java, C, or C++ in college and found them too complicated, try Ruby. It's different. Most programming languages are designed to make the compiler happy. Ruby is designed to make developers happy.
Why Rails? It makes it very easy to build web applications. Many of the popular web applications that you know and love (Shopify, Airbnb, Zendesk, Github, HEY, and thousands more) are using Ruby on Rails. Even the initial version of Twitter was built with Rails. Finally, if you want to program Ruby professionally, you'll need to learn Rails.
Before you feel intimidated by this list of books to read, remember that learning to program is a long-term journey and it's good to set clear expectations.
What You Should Know Before Starting Your Programming Journey
Here're a few things to keep in mind before you jump in, if you've never programmed before but want to start.
Your age doesn’t matter. You can start learning to program at any age and become quite good at it in a relatively short time if you apply yourself and take it seriously. Don't let anyone tell you that you're either too young or too old to code.
Your background doesn’t matter. No matter what work you were doing before, you can (and will) learn how to program if you practice diligently.
You'll have to spend some money, but it won’t be thousands and thousands of dollars on university degrees, coding bootcamps, or online programs. Just be willing to purchase a few good books. And I mean purchase, do not use the free PDF copies you find online. Trust me, the efforts you invest in your learning resources impact how you learn.
The psychological concept of effort justification states that people tend to attribute a higher value to an outcome if they've put effort into it.
You don’t need to study programming for eight hours a day. In fact, you shouldn’t. That’s a road to burnout. If you have a busy schedule, studying in full concentration for 90 minutes every day is more than enough, even better than doing nothing for a week and a marathon 8-hour session on Sunday.
No matter what anyone tells you, Ruby is the best programming language to start your programming journey. Don’t think that Ruby is some niche language used by passionate hobbyists. Some of the biggest companies you know use Ruby.
There's a lot of bad advice out there about getting started in tech and people are trying to get into AI/Crypto and trying to build Web3 apps when they don't know what HTML is, just because some influencer on YouTube told them to. DON'T DO THAT!
Finally, don’t expect to start learning tomorrow and hope to become proficient and land a cushy, work-from-home tech job next month. This is a long-term process. Anyone who tells you otherwise is trying to sell you their book/course/bootcamp and get your money. However, if you stick to the path and practice every day, you’ll be amazed at how much progress you can make in just a few months.
With that out of the way, let's look at how you should proceed on your journey to become a web developer.
Assuming you've never programmed before, I recommend starting with Chris Pine's excellent book Learn to Program. It's an awesome beginner-friendly book, and Chris explains each topic in programming in an easy-to-understand way. This book should get you started with Ruby pretty quickly, also teaching you the fundamental concepts in programming such as conditionals and loops.
Learning the basics of any programming language is one thing, you need to know the best practices in that language to write good software. For this, check out Russ Olsen's Eloquent Ruby, which is one of the best Ruby books I've read. I read it twice last year and can't recommend it enough. Even though it was published in 2011, most of the best practices mentioned in it haven't changed.
At this point, you should be able to write simple Ruby programs. Now you can start the next section (learning to build web applications) in parallel while you learn intermediate Ruby.
After reading these two books, you should have a solid understanding of Ruby and you'd be able to read and write Ruby programs. At this point, you must be itching to go even deeper into Ruby and learn the various core classes and standard libraries included in Ruby.
To learn Ruby in depth, I recommend reading Programming Ruby by Dave Thomas. Also known as the Pick-Axe book, this is one of the oldest and most famous books in the Ruby community, and many well-respected Ruby & Rails programmers attribute their initiation to Ruby to this book. If you decide to read just one book from this list, this should be it.
Finally, there's one book that I recommend to everyone to really master the Ruby language, which is Paolo Perrotta's Metaprogramming Ruby 2. This book not only teaches the powerful metaprogramming concepts in Ruby, but also how to use them judiciously.
The primary benefit of metaprogramming I found was not so much in writing clever code, but instead reading and understanding open source code, especially the Rails source code. For a preview, check out my notes.
I recommend using the following two books as references at hand instead of reading them end-to-end.
- The Well-Grounded Rubyist is a good book that covers various features of Ruby in-depth, including metaprogramming.
- Hal Fulton's Ruby Way: The Solutions and Techniques in Ruby Programming is a wonderful book covering core classes and standard library in-depth.
Intermission: Learn Web Development with Sinatra
When you feel comfortable with Ruby, the obvious next step is to learn Rails. However, I'd ask you to be a little patient and try Sinatra, which is a lightweight web framework for Ruby.
I feel that too often, new developers make two mistakes on their path to becoming a Rails developer:
- Jumping into Rails without learning Ruby, or
- Starting to build Rails applications without having a basic understanding of how most web applications work.
Then they see everything that Rails does for you, and either feel it's all magic (it's not!) and get overwhelmed and ultimately discouraged and leave the journey altogether.
Don't do that!
Sinatra is very simple to get up and running in less than a minute. It's just a Ruby file.
# myapp.rb require 'sinatra' get '/' do 'Hello world!' end
This stage shouldn't take long. Your goal is not to master Sinatra or web development right now (it's a lifelong journey), but just to get familiar enough to not get scared when you see a Rails application.
Learning Ruby on Rails
After you've been programming in Ruby for a while, have a basic understanding of how web applications work, and have preferably built a few, you're ready to learn Ruby on Rails, the framework you'll use most likely as a professional Ruby developer.
To learn Rails, I recommend starting with The Agile Web Development with Rails book. Reading this book end-to-end and actually coding while you're reading will give you a great introduction to Rails.
Next, you should read Michael Hartl's Rails Tutorial. Again, read it end-to-end and build the project in the book as your read it. Reading these two books and live-coding Rails apps will give you the confidence to build web applications on your own.
At this point, you'll be curious to learn how Rails really works and more advanced features of it. To learn how Rails works, there's nothing better than reading the Rails source code.
For a deeper understanding of Rails, I recommend reading the latest edition of The Rails Way by Obie Fernandez. A warning: reading this book is a slog, as it's huge and covers almost all of Rails features in-depth. However, the trick is to read this book over multiple passes. Every time you read it, you'll learn a bunch of new things that you didn't get before. I'm currently on my third read of the book.
Finally, to understand how Rails works behind the scenes, read Noah Gibbs' book: Rebuilding Rails. It's an excellent book that shows you how you can build your own web development framework. After reading this book, a lot of Rails magic started making sense to me. Highly recommended.
That's a wrap. I hope you enjoyed reading this post and plan to start reading at least one book from the above list.
If you’ve read till the end, I’ve got something to ask you. Most of the people reading this blog are already experienced Rails developers, so you must be already aware of these books and know many points I mention above.
What I ask you is that you share this post with someone you know who wants to learn to code but doesn’t know where to start. Whether it’s your retired mom or dad, your teenage kid, or your friends in finance or marketing who want to switch careers. As I mentioned earlier, there's a lot of bad advice on getting started in programming, and I think they'll find it useful.
As always, if you have any questions or feedback, or would like to recommend more books, please leave a comment below or send me an email. I look forward to hearing from you.
If you'd like to receive future articles directly in your email, please subscribe to my blog. If you're already a subscriber, thank you.