Why I Taught Ruby

Photo by Jonathan Simcoe on Unsplash

In my second year of teaching, I changed programming languages. I previously taught my introductory programming class in Java. I wrote up exactly why I thought that was a good idea. I was wrong.

With the change of language, the class’s content changed along with it. With Ruby, the class moved from basic programming concepts - variables, loops, conditionals - to teaching basic sorting, trees, encryption and random number generation. With Java, the class moved from those basics, but instead was intended to culmination in a OOP-driven standalone application. Again, that was wrong.

Here is why Ruby worked:

Platform Accessible

I said this about Java too, but with Ruby, I decided to leverage Repl.it instead of depending upon the students’ dealing with their own laptops to do development. The platform allowed them to program in class, save their work online, and send me assignments through the Repl.it system. Additionally I could use the same platform to provide code samples and give out assignments.

Theoretically I could have done this with Java as well, but with the focus on Java on being able to spin up real applications and work in a real IDE (Eclipse in my case), running it through Repl.it would have defeated this achievement as they couldn’t actually make a real JAR (at the time).

Compilation and typing are still there

How do you explain compilation - it converts english and symbols to machine instructions. And you have to usually type a command or push a button do this, like printing a document. Done. No need to see the little progress bar on the screen. 

Typing? Even with dynamic typing in Ruby, learning the language still requires the sense that variables are treated differently based upon whether they are a Hash, number, string or object. The lesson isn’t lost by having to explain what a double is.

With those easy topics dealt with verbally rather than struggling through syntax, I made lessons harder

While previously I praised the fact that students had to focus a little more with Java because of curly brackets, typing variables, and just the overhead of running a hello world program, that is a shitty check on student ability. It’s like telling music students that they have to tune the piano before they can play it.

Ruby is extremely easy to get started and has a relaxed transition when moving from basics to OOP. With this in mind, I was able to breeze past variables, conditionals, loops and functions so that we could eventually discuss more difficult topics.

OOP is generally pointless for students

I still covered OOP in my class, but it was more as a demonstration in how to properly uses classes. In this case, the lack of emphasis on OOP in Ruby (as compared to Java at least) and its syntactic focus on elegant short lines of code made me focus on how we could work with really interesting algorithms in a succinct bits of code.

Think about - is it more interesting for new students to see how a binary tree automatically sorts numbers in a few lines or have them build another damn Car class with Wheel objects?

Students new to programming should learn what’s possible out there and see it working, not how to build application stable code.


Overall, Ruby took my sights off of OOP and its clean syntax forced me to move past the minutia that students shouldn’t need to concerns themselves with. Instead, they were given the chance to see how much they could do with a few lines and a computer science mindset.

They can learn about doubles versus floats later if they like.