The Well Grounded Rubyist is the best book to learn about objects and message sending. Messages are more important that objects and David Black gives messages the attention they deserve.
David doesn't even introduce the if keyword until page 150! This is not your typical programming book.
The Well Grounded Rubyist is the best way to level up from a beginner to an intermediate Ruby programmer.
Make sure to read The Well Grounded Rubyist before Practical Object Oriented Design in Ruby and Metaprogramming Ruby.
Practical Object Oriented Design in Ruby (POODR) is a masterfully written book on object oriented design.
Programmers cannot predict the future, but we can design code so it can easily be adapted to incorporate future feature requests. POODR explains how to write well designed code that is easy to change.
POODR talks about message sending a lot so make sure to read The Well Grounded Rubyist first.
Metaprogramming Ruby continues where The Well Grounded Rubyist leaves off.
Metaprogramming is code that writes code. It's awesome and fun!
The book covers a lot of core Ruby concepts that are critical to understand metaprogramming: Ruby's object model, method lookup, and module.
Once the foundation is laid, basic metaprogramming concepts like define_method
and method_missing
are covered.
Before you know it, you will be writing a domain specific language with Ruby!
You will be a Ruby expert after reading this book.
Beginning Ruby was written in 2011 by Peter Cooper, an influental member of the Ruby community.
Beginning Ruby is a bit scattered and jumps into technical concepts very quickly, so it's not suitable for beginners.
An experienced programmer would learn a lot from Beginning Ruby, but there are other books that are much easier to follow.
Try Ruby is a 15 minute tutorial on the very basics of Ruby. All code is run in the browser.
Unlike the other tutorials, Try Ruby isn't scary! They ease you into the material.
In level 5 the tutorial covers the Dir
module, which is confusing because the code is running the browser and the file system isn't visible.
Learn Ruby the Hard Way is written by the controversial author Zed Shaw. He wrote Rails is a Ghetto in 2007 and people didn't really like it. Nonetheless, people seem to love his books.
Zed is right that learning to program requires a lot of practice and persistence. Repetition is how you learn.
The first 39 lessons are approachable and the course gets much harder when modules, classes, and objects are introduced in lesson 40. If example 40 scares you, just stop reading and move on to the next learning resource.
Zed wraps up the book with some bizzare Advice from an Old Programmer. I love working as a full-time programmer and absolutely do not agree with "Programming as a profession is only moderately interesting". I think programmers at technology companies are respected and do not agree that "People who can code in the world of technology companies are a dime a dozen and get no respect".
Use Zed's learning resources and ignore his angry rants.
Codecademy gives little descriptions of key programming concepts and provides a Ruby shell to evaluate your knowledge during each step. The lessons are build towards people that are not familiar with Ruby and have never programmed before.
The course is for beginners, but the code gets scary and complex quickly.
The first line in the method (puts "That's not an integer." unless n.is_a? Integer
) uses a lot syntactic sugar and would even be difficult for experienced programmers that are not familiar with Ruby to read.
Codecademy is demonstrating how this code can be broken up with methods, but this is still very scary for newbies.
Codecademy also jumps into procs and lambdas quickly. New Ruby programmers don't need to know how to yield with parameters.
Parts of Codecademy are great and other parts are terrifying and should be skipped. You might not know what parts should be skipped so the course might make you feel bad.
The Ruby Lang quickstart tutorial starts off as a promising interactive Ruby console (irb
) based introduction to the language and quickly becomes too complicated.
The tutorial quickly asks you to write an 11 line class in your irb
console:
irb(main):024:0> class Greeter irb(main):025:1> def initialize(name = "World") irb(main):026:2> @name = name irb(main):027:2> end irb(main):028:1> def say_hi irb(main):029:2> puts "Hi #{@name}!" irb(main):030:2> end irb(main):031:1> def say_bye irb(main):032:2> puts "Bye #{@name}, come back soon." irb(main):033:2> end irb(main):034:1> end
This code is certain to baffle a newbie programmer. An experienced programmer would prefer to write all this code in a text editor.
This tutorial can be used by an inexperienced programmer, but newbies should stay away.
RubyMonk jumps right into objects in the first lesson. This course is suitable for experienced programmers and beginners should stay away.
Once you are comfortable with the fundamentals of Ruby, this is a great course to level up.