I was a teenager when I first started to learn programming. I had a really poor dial-up connection (seriously, 32k/s was about the fastest our connect ever hit) and a lot of free time. I was also constrained to living in a small town with very little resources in terms of modern programming books. These constraints made one thing clear, as I set out to learn to program: I needed a language that would “just work” and was more or less self-documented on the machine. I discovered Ruby. Little known to anyone in my sphere of influence, I learned early on that ruby was actually one of the few languages found on nearly all operating systems by default. I wouldn’t need to download anything, the documentation was built into it’s man pages and interactive shell, and the language wasn’t compiled so I wouldn’t need much CS knowledge. So I started hacking…
Fast forward to today. I’m still a fan of Ruby, and the language has grown to a level I never would have thought possible. Ruby feels like the new C in terms of developer adoption and cross-platform compatibility. While it’s not the ideal language for literally every situation (a fact that is true for any programming language) it is one of the most versatile and enjoyable to learn and use on a regular basis. With that said, there are a myriad of teaching tools to learn Ruby, and my goal with this post is to weed out many of them and point you in the best direction possible for learning. This is an organic, opinionated post, based on my own experiences learning, teaching and developing with Ruby professionally.
Nearly any OS will do, and you probably don’t need to install anything to get up and running. However, the following tools and ideas will definitely help you in the long run:
Learn the basics of terminal
Learning the Basics
Shameless plug: Unicorn.TV is a website dedicated to teaching programming in a way that will make you a “unicorn” in the dev world. We often touch on concepts of design, frameworks, and tools in a wide variety so that you don’t get married to one way of thinking or problem solving.
A great starting point for learning Ruby basics is through codecademy. I have sent every one of my apprentices to their Ruby track and all of them agree it’s probably both the easiest and broadly the best place to begin.
Learn the basics of Ruby and programming in general
Plan your first application
If you have learned the basics of Ruby programming, you are ready to build an application. Do not. I repeat, do not jump into a framework yet. Yes, Rails is all the rage, but you’ll miss out on some low level ideas and intimacy with Ruby as a language if you dive into any framework at this point.
Instead, I recommend building a console application. At this point, you should build something that has clean code, rather than building a useful product. Why? I assume you are learning Ruby to get/advance/start a job in this field. Products take many disciplines to build well, but an elegant program only takes one. You can use a console app as an attachment for code reviews and submissions when sending your application around (most companies will want to see at least one sample of your code). This will be easy to build and run for any code review, and because it’s only one language and technology, you will be much more intimately familiar with the inner workings of the application should you have to explain it.
Create your own application. Give it some thought before you write a single line of code. Maybe you’ll build a bot that seems to talk to you. Or perhaps you create a text based game. Whatever the case is follow the KISS principle: keep it simple, stupid! Stick with console, and focus on commenting, documenting and consistently cleaning your code to make it as pretty as possible.
Create a plan and feature set for your application
Start by creating a skeleton console application
Make a first pass at building the app with little to no assistance from the web
Learn Ruby the Hard Way
No, you are still not ready to learn a framework like Rails. You will get there in time, but you still really need to master Ruby as a language! If you have finished your first pass at your application, it is time to challenge yourself and see how naturally you can solve problems in Ruby now. These tests will go by quick as you master the language, and until you can pass all of these (without assistance) you will be ready to learn any framework you desire!
Learn to problem solve by fixing bugs with Ruby Koans
Read and follow along with: Learn Ruby the Hard Way
Measure your abilities with Code School
Unless you have a good reason to not learn web, you may as well learn Rails. You should absolutely, 100% do this through Code School and I’m not just saying that. I personally make every single one of my apprentices learn Rails through Code School because it’s they do the best job of explaining not just what but why you should follow certain standards. They’re also the best assessment tool out there for others to know how well you actually know Rails. It’s one thing to say you know it, and another to actually understand it. I recommend signing up for a yearly account and just swallowing the cost to invest in yourself, as they will teach you much more than just Ruby/Rails.
Come back here!
We don’t just post on introductory concepts. Most of our tutorials span multiple disciplines and methodologies, and if you learned anything from this tutorial, chances are that you have more to learn! We are always looking for good authors too, so if you like to write technical articles shoot us an email!