I just returned from ConFoo 2015, which BTW is a great conference with lots of good talks and events. The good thing about a multi-discipline conference like this, is that you get to talk to people from different technological and programming backgrounds.  I met people from the PHP, JavaScript, .Net, Java and Python worlds and -inevitably- we got talking about Ruby and the best way to start learning it. My part of the conversation always boiled down to the same arguments and recommendations, as distilled through my own experience of coming to Ruby from a C++ background. Here they are:

About You

You are an intermediate / advanced level developer who understands object-orientation and is familiar with design patterns. You’re probably a competent Java, C#, C++ or Delphi programmer.  Less likely, you’re a PHP, Python or Perl programmer but you still grok OO and DPs. You appreciate elegance, efficiency and the joy of coding.

Why you need to do it

Because learning Ruby will make you a more efficient and happy programmer.  Even if you decide to stick with your existing language, knowing Ruby will make you a better programmer in it.

Step 1:

Read this book:

Picture

it brilliantly takes something familiar (design patterns) and uses it to illustrate Ruby concepts and idioms.  It starts with some fundamental concepts and then cranks up the intensity with each chapter. By the time you finish reading it you’ll have a good basic understanding of Ruby. As a pleasant side-effect, your knowledge of design patterns will probably also have increased. If the last 2-3 chapters seem a bit of a struggle (which they might if you come from a static language background), just leave them out for now - you’ll come back to them later.

Now you can try this tutorial. It will recap your basic Ruby knowledge in a practical, interactive way. It will also fill-in any blanks left by the Design Pattern  book.You now understand basic Ruby principles, as well as concepts such as blocks, duck-typing and the usage of modules. Time for the next step:  

Step 2:

Complete the micro-blogger tutorial. It will reinforce the basics and will show you how to use Ruby in the wild, that is by integrating gems and third-party APIs into your code just like you need to in the real world. Once you’ve done this it’s time for some more advanced knowledge: You need to get familiar with the way Ruby handles lambdas and closures. There’s a plethora of articles you can google on the subject.  With extreme bias, I would recommend this one

You must get intimate with Ruby collections, specifically the more functional (i.e. map/reduce) aspects of them. So go and read chapter 9.  While you’re at it, feel free to read the rest of the book too. It certainly won’t hurt and it can be very informative.

Step 3:

OK, you now understand the Ruby idioms and appreciate the ‘magic’ Ruby performs. But how does this magic happen? Time to find out by whipping out this book: This book will help you comprehend how Ruby works and how you can utilise it to the max. It will get you acquainted with meta-programming (i.e. code that writes code) and will explain how the Ruby Object Model functions.  This is essential knowledge if you want a good understanding of the language. Once you grok the Object Model it becomes much easier to learn stuff like Rails or write your own gems.  The book is also littered with little Ruby idioms and techniques, a.k.a ‘spells’, that will increase your efficiency and understanding ten-fold.Once you’ve been through this book, you may want to re-visit the last three chapters of ‘Design Patterns in Ruby’; you’ll find they now make a lot more sense.Now go and test your Ruby skills here.

Step 4:

Finally, you understand enough of Ruby to make it your own. The last step is to build your own project. Pick an idea, any idea, it doesn’t matter. It could be something you’ve already done using another language, maybe an old work project. If you can’t think of any, here’s an idea for a project. Now implement it in Ruby. If you get stuck, this book makes for brilliant reference and guide. Once your project is working, sit back , light up a cigar and bask in the knowledge that you’re now familiar with an elegant and effective all-purpose language that will make your programming life much easier and more enjoyable.  Happy coding!