Learn Ruby the Hard Way, Part 2: Ruby

(Click here for Learn Ruby the Hard Way, Part 1: Command Line)


I REALLY enjoyed the first 2/3 of this book. I tend to be a hands-on learner, and I like getting to try things for myself, so once I had Ruby installed on my computer and could try the exercises, and then modify them and see what happened, I felt like I had a lot of freedom to explore and figure things out.

Learn Ruby the Hard Way starts out slow; the first program was this:

puts "Hello World!"
puts "Hello Again"
puts "I like typing this."
puts "This is fun."
puts "Yay! Printing."
puts "I'd much rather you 'not'."
puts 'I "said" do not touch this.'

Also, rather than working in the IRB, you are instructed to type out (and debug) every single exercise, save it in a file, and then run it in PowerShell (which is where my in depth knowledge of “cd” and “Ruby file.rb” came in handy!). I really appreciated having a written record of all of my exercises, (although figuring out that I had to save my files as .rb files so they would run was new to me at first!); that way, I could go back and look at the code I had been working with so I could figure out why each piece worked and how it built on the previous piece.

Exercises 1-10 were a breeze; mostly printing, pretty repetitive, good for memorizing how printing works and starting to feel comfortable in Ruby.

Exercise 11 picks up the pace with gets.chomp–asking the user for input and saving it to a specific variable. I had so much fun with this that I took a several hour detour playing with different ways to use gets.chomp and looking up more information online.

And then exercises 12-32 keep building, step by step, in a way that I was able to follow, yet found just challenging enough to hold my interest.

It was around exercise 33 that I felt the explanations started to get a little too quick, the exercises a little too long. That’s when I discovered both Stack Overflow and Testhead. Testhead covers the exercises step by step; when I got stuck, it was easy to look at the code on his site and see where I went wrong (for example, here is his version of Exercise 35… I’m not much of a choose-your-own-adventure game person, so I wasn’t as enamored with building my own bare-bones game as I imagine some other people would be. At the same time, it was  really good practice in if/else statements, if a little gory for my taste.).

Exercise 39 (Hashes) is where I got stuck, possibly for good. The code needed for the exercise is so long, and so particular, that I got tired with the typing and scrolling and checking. It was too hard for me to follow why I was using those keys and values in the first place. When I glanced ahead, it looked similarly difficult to follow, so I decided to mark where I left off and head over to CodeAcademy to try their Ruby lessons, to see if a different perspective would help me understand better (Spoiler alert–yes! Learning from more than one source is really helpful. But more on that later).

Overall, I am glad I started with Try Ruby the Hard Way. Starting with the real interface, rather than online exercises, gave me a lot of confidence, and I appreciated all of the in-depth practice I got with each concept along the way, although I found the last 1/3 a little too challenging. I would recommend it to everyone (I have a lot of friends who would find this WAY too intimidating), but after trying the hard way first, a lot of the other exercises I came across felt easy and intuitive by comparison.

Thanks, Zed!

Next up, Codecademy Ruby

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s