dark mode light mode Search Menu


The original creator of Ruby, Yukihiro Matsumoto of Japan, wanted to find a programmer friendly scripting language that was not difficult to learn or code with over time. Because he could not find such a language, he developed Ruby. The first release was announced on the Japanese ruby-talk list on December 21, 1995, almost three years after the language was announced on the same list.

Ruby was influenced by the best features and qualities of Perl, SmallTalk, Ada, and Lisp, among other languages. Bad experiences with these languages also influenced the design of Ruby. For example, in Perl there might be a number of ways to accomplish a task while Python has only one way. Ruby chose the Python model. As Matsumoto described in the Ruby Language FAQ:

“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.”

Ruby is a general purpose object oriented scripting language that is dynamic and reflective. Which is a long way to say the language is designed to spare programmers work required by other less flexible languages.

What Makes Ruby Special?

One interesting feature of Ruby is its reliance on the Principle of Least Astonishment or POLA. As noted in an article published earlier in this magazine, POLA tries to give software users what they expect to see when they expect to see it.

Perhaps the easiest way to describe POLA is to talk about common web page buttons. At the bottom of a web page form is a Submit button. Everyone who has filled out a form online expects to see at the bottom of the form a rectangle with the word “Submit” on top. Imagine if there was only a link that said “Submit”: that would confuse lots of people.

The Submit button creates the least astonishment for people who fill out a web page form. It’s expected. A link instead of a Submit button causes confusion, or the greatest astonishment.

With programming languages, POLA means the rules of programming are simple, obvious, and in all the right places. It involves efficiency, less code, and more power. POLA with programming languages also involves reflection, the ability for a programming language to interpret code in a dynamic way. For example, Ruby uses reflection to minimize how much hard coding of method names is required. When a script is run, Ruby figures out the best way to call different methods based on how the code is organized.

Ruby also has a few interesting features. For example, constants are always capitalized. And the @ symbol is used to define the scope of a variable, whether it is available only within a method or a class that contains the method. Perhaps the most programmer-friendly aspect of Ruby? You will never have to use semi-colons again in your code, or worry about them.

The name Ruby comes from a desire Matsumoto had to name the language after a jewel, like the Perl language. The choices were coral or ruby. Ruby was chosen in part because it was the birthstone of one of the early developers of the language.

How is Ruby Used?

Because Ruby is designed to be programmer friendly, the language is used in lots of places where people want to create software quickly that can be extended over time with minimal recoding. With Ruby on Rails (RoR), a web application framework, Ruby is most often used to create online applications like Twitter, Kickstarter, Basecamp, Shopify, and many other applications which need to be developed quickly and scale to lots of users over time. It’s a great language for software startups.

Here’s a code example from the Ruby website, to give you an idea how the language works:

# Output "I love Ruby"
say = "I love Ruby"
puts say

# Output "I *LOVE* RUBY"
say['love'] = "*love*"
puts say.upcase

# Output "I *love* Ruby"
# five times
5.times { puts say }

If you are familiar with Python and other languages, you’ll easily see puts does the same work as print() in other languages. And say.upcase would be the same as strtoupper($say) in PHP. Which is another thing to notice: the variable say doesn’t use a $ to visually indicate it is a variable.

Learn More



Ruby from Other Languages

Describes differences between Ruby and C/C++, Java, Perl, PHP, and Python languages.

Try Ruby in Your Browser


The Ruby Language FAQ


Comparison of Programming Languages




4 Reasons Why You Should Learn Ruby As Your First Programming Language


What’s Special About Ruby?


What makes Ruby an Elegant Language?


What are the Benefits of Ruby on Rails? After Two Decades of Programming, I Use Rails


The Many Interpreters and Runtimes of the Ruby Programming Language


A Beginners Guide to Ruby


Learn Ruby the Hard Way

Actually this online book is one of the easiest ways to learn Ruby in depth.

Related Posts