How To Learn Ruby
Here’s my story, and how I got started with Ruby.
I first stumbled upon Ruby in 2007. All I wanted back then, was a language that I can build something cool with. I was going from knowing nothing to knowing something, so the information had to be as jargon-free as possible.
I still remember seeing the How to build a blog engine in 15 minutes with Ruby on Rails demo and thinking “Yes! This is how easy it should be”. That was when I knew Ruby was the perfect language for me.
Ruby jumped at me through that demo because I didn’t know how to code, but yet the whole thing made sense to me. It was a language I could understand, and more importantly, a language I could learn.
Learn by doing
So I dove right in and started building, not knowing anything about Ruby or Rails. I wanted to learn by doing. I followed the demo, I copied it word for word, then tweaked it, then tweaked it even more. I made it my own. I built something. It felt awesome, I was really proud of my achievement.
I remember how previously I have struggled for months trying to build a contacts application (a simple database table for storing contacts) in Perl, and failed miserably. Not because Perl was a bad language, but because there were too many new concepts to take in.
So Ruby on Rails helped with that. It made it very easy for me to learn by copying what others have done and adapting the code to what I wanted to accomplish. I basically stole 90% of the code and changed the parts that I wanted to be different. That was all I did. But it worked.
How to learn to code
Steal as much as possible. Find code that does 90% of what you want, and try to understand it by changing things here and there, and see what happens.
That basically sums up my learning process back then. And I think it’s important to remember you don’t have to study computer science or earn some fancy degrees to be able to learn how to code.
The single and most important thing you need is perseverance. Just hang in there, learn a new thing every day and I can guarantee everything will make sense soon enough.
I understand how intimidating the field of programming is if you’re new to it. But I can assure you that everything can be learned. I know because that’s how I’ve done it.
You just need to keep adding 1% to your knowledge each day, and soon enough, you will be amazed about how much you know.
So here’s what I recommend you do:
- Have a project in your mind (know what you want to build).
- Try to find tutorials that get you 1% closer to your goal.
- Study that code and adapt it to your project.
- Repeat point 2 and 4 until you’re done.
- Pick a new project and start over.
It might sound silly, especially if you expected me to tell you how you need to go to college and study hard and read books and such.
Don’t get me wrong, books are great. I read programming books like a maniac because I love programming so much. However, books didn’t help me when I first started, tutorials did.
Do I need to learn Ruby first?
You probably noticed I didn’t start with Ruby. I started learning Rails. And for a long time I didn’t even care about Ruby, I just knew how to build an application without learning the language.
How is that possible you ask? Well, I’m glad you asked :)
Here’s the thing. I knew the patterns. I knew that if I wanted to save something to the database for example, I needed to write a few commands in a particular order, and if I wanted to create a form on a web page, then there was a different set of commands (or recipe) I needed to follow. That’s how I learned.
Connecting the dots
I’ve coded like that for a long time. And it worked. It really worked, I had a well-paying job and everything. But more importantly, it laid the foundations for learning the language. And not just the Ruby language.
It’s not that I didn’t try to learn Ruby before. It’s just that I found learning the language for the sake of it very boring and I couldn’t make the connection between the theory and the real world application. In my mind, I saw the application I wanted to build, but I couldn’t connect the dots with the what the theory was telling me.
You can’t connect the dots looking forward; you can only connect them looking backward. So you have to trust that the dots will somehow connect in your future. — Steve Jobs
I feel like this quote fits perfectly with my experience. I could retain that information for a day or two and then lose it completely. It didn’t resonate. I had nothing to associate it with.
Make it click, to make it stick
That happened to me back then, and it happens today. If I’m learning something new, and I don’t have anything to associate it with (like a practical application), it doesn’t click. And it doesn’t stick.
If learning doesn’t click, you’re doing it wrong.
So that’s why the non-traditional way of learning worked better for me, and still does. I need to connect the dots looking backward, I need to see an example.
That being said, once you have all those examples, patterns, and recipes in your head, then it’s a different story.
I can pick up a programming book now, and read it in a few days no problem. But that’s simply because everything I read clicks now. It’s because I have enough examples in my head now, from all those years of practice, to easily make any new concept fit.
Let me give you an example of what I’m talking about here.
My application lets you upload photos of your pet, share them with your friends, and even find mates.
My application is like Facebook, but for pets.
Which one seems easier to understand, and remember? I bet you didn’t chose the first one, did you.