1. It’s Ruby Time

Congratulations on finishing The Basics! (you did do all the lessons, right?) You’ve accomplished something very important: you built a foundation for mastering code in any language. True mastery doesn’t come easily – it takes a lot of hard work and dedication. By learning the basics first, you’ve given yourself a big advantage in coding like a professional!We’re proud of you, and we want to reward your hard work. We think you’re ready to begin learning your first real programming language: Ruby, a language that comes from the Land of the Rising Sun.

What Is Ruby?

Ruby is a dynamic, reflective, object-oriented, general purpose, interpreted, and open-source programming language.

These are terms that describe how a programming language is used and written. It’s a lot to swallow all at once, so let’s go over each term one-by-one and talk about what it means.

Ruby Is A Dynamic Language

Remember type annotation from lesson 6 of The Basics? That’s when we specify what kind of data a variable can hold. If we want our program to store our age, we would declare a variable like this:

age as Integer = 38 

This can get annoying to write out after a while, so Ruby makes it easier. Ruby is a dynamic language, which means that you don’t have to say what kind of variable you’re creating. When you declare your variable, Ruby figures out what type it is on its own.

Even better, you can change the type of variable whenever you want and Ruby won’t complain. For example, you can assign an integer to ‘age’, and then change it to a string:

age = 38 age = "thirty-eight years old" 

Ruby has no problem with this. It performs type-checking as it runs when you start the program and figures out what kind of data you’re storing by simply looking at the data itself. If you’re storing a number in your variable, Ruby knows that you probably want it to be a number.

Dynamic languages make writing code pretty easy, but they can also have their downsides – as we’ll see later on.

Ruby Is A Reflective Language

This is a complex term, and we’ll be revisiting it later in the course. For know, just know that a reflective language can check its own code as it runs and make changes to itself. We’ll show you how handy this is when we get deeper into Ruby.

Ruby Is An Object-Oriented Language

We don’t have to explain this one to you, right? Remember how proud we are of you for finishing The Basics? You learned about this in lesson 10!

Ruby is an object-oriented language because we can use it to write classes and create objects from these classes.

Ruby Is A General Purpose Language

Some programming languages are made to do very specific things, like SQL for working with databases.

Languages like Ruby are different – they’re called general purpose languages. This means that they’re designed for making programs that can do a lot of different things. With Ruby, you can write web applications, software meant to run on a server, and even mobile apps.

Ruby Is An Interpreted Language

Ruby is an interpreted language, which means that you’ll need the Ruby interpreter in order to run Ruby programs. We taught you all about interpreted languages back in lesson 1 in The Basics.

Don’t worry, we’ll show you how to install the Ruby interpreter on your computer. In fact, depending on your computer, you might already have one!

Ruby Is An Open-Source Language

Ruby and its interpreter are open-source software. This means that coding with Ruby is free: you don’t have to buy a license or pay royalties on your source code. You can also get into the source code of the language itself and modify it to your heart’s content – which is probably too advanced if you’re reading this!

The History Of Ruby

Now that you know what Ruby is, let’s talk about how it came around. After all, there are other similar languages out there (Python being a close sibling), so what makes Ruby different?

Ruby was created by a Japanese programmer named Yukihiro Matsumoto – better known as ‘Matz’ – in early 1993.

Matz was a huge fan of object-oriented programming, but he felt that other popular interpreted languages treated object-oriented programming like an afterthought – so he decided to create his own:

I was talking with my colleague about the possibility of an object-oriented scripting language. I knew Perl (Perl4, not Perl5), but I didn’t like it really, because it had the smell of a toy language (it still has). The object-oriented language seemed very promising. I knew Python then. But I didn’t like it, because I didn’t think it was a true object-oriented language — OO features appeared to be add-on to the language. As a language maniac and OO fan for 15 years, I really wanted a genuine object-oriented, easy-to-use scripting language. I looked for but couldn’t find one. So I decided to make it.

He began work on this new language, Ruby, in 1993, and released the first public version (0.95) on December 21, 1995. 20 years later at the time of this writing and Ruby is at version 2.2.3.

The design of Ruby was influenced by two major factors: programmer happiness and the principle of least astonishment.

Regarding programmer happiness, Matz said:

Often people, especially computer engineers, focus on the machines. They think, “By doing this, the machine will run fast. By doing this, the machine will run more effectively. By doing this, the machine will something something something.” They are focusing on machines. But in fact we need to focus on humans, on how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves.

And on the principle of least astonishment, he said:

Everyone has an individual background. Someone may come from Python, someone else may come from Perl, and they may be surprised by different aspects of the language. Then they come up to me and say, ‘I was surprised by this feature of the language, so Ruby violates the principle of least surprise.’ Wait. Wait. The principle of least surprise is not for you only. The principle of least surprise means principle of least my surprise. And it means the principle of least surprise after you learn Ruby very well. For example, I was a C++ programmer before I started designing Ruby. I programmed in C++ exclusively for two or three years. And after two years of C++ programming, it still surprises me.

In other words, if you take the time to learn Ruby’s standards, there will be less surprises for you as a programmer. You can expect how a certain feature works without learning it at length.

All of this makes Ruby a great programming language for beginners. And since this is a Ruby course, you’re well on your way to becoming very familiar with Ruby’s standards!

Ruby Interpreters

The official Ruby interpreter is called MRI, which stands for Matz’s Ruby Interpreter. But that’s not the only Ruby interpreter out there: there are plenty of different interpreters made other programmers that can run Ruby code. Other well-known interpreters designed to run Ruby for different purposes are:

  • JRuby, a Ruby interpreter made to run on the Java Virtual Machine.
  • Rubinius, a compiler that can turn Ruby code into machine code.
  • Opal, a web-based interpreter that translates Ruby code into JavaScript.

For this course, we’ll be sticking with the classic MRI interpreter. This just gives you an idea of the different ways Ruby can be used to make useful programs.

Ruby Platforms

The MRI interpreter is available for all the big three operating systems: OS X, Windows, and Linux. In the next lesson, we’ll teach you how to set up your Ruby development environment on your computer – you’ll be writing your own code in no time!


We’ve taught you what Ruby is and why it was made. Next we’ll teach you how to set it up so we can start some real-life programming.

Important Words

  • Ruby (of course!)
  • Dynamic
  • General Purpose Language
  • Open-Source Software
  • Yukihiro Matsumoto, a.k.a. Matz
  • MRI, a.k.a. Matz’s Ruby Interpreter


We went over a lot of information about Ruby, but there’s still a lot more to it. For this lesson, we want you to do some research on Ruby and teach your findings to your fellow students in the Forums. See if you can learn something new about Ruby that wasn’t explained in this lesson.

As a bonus, also look up open-source software and describe what it is in the Forums. Sharing your findings here will get you ready for sharing your own open-source code with the world!

Share to friends