Ruby is an open-source, interpreted language that was created by Yukihiro "Matz" Matsumoto in the mid-1990s. Despite being over 20 years old, Ruby experienced a surge in popularity beginning in 2005, with the release of Ruby on Rails, a framework that made it an ideal choice for web application development.
The initial release was in 1995, with additional releases the following years. As the language has gained in popularity, new releases continue to add more features and capabilities.
Matz’ initial goal was to create an object-oriented scripting language that went beyond what was currently available. He had worked with Perl and was unimpressed. Similarly, he felt that object-oriented features had been added to Python as an afterthought. As a result, his goal was to create a scripting language that was built from the ground up to be object-oriented, while also being accessible and very easy-to-use.
Ruby takes object-oriented programming to a new level. As the official site says: “In Ruby, everything is an object. Every bit of information and code can be given their own properties and actions. Object-oriented programming calls properties by the name instance variables and actions are known as methods. Ruby’s pure object-oriented approach is most commonly demonstrated by a bit of code which applies an action to a number.”
According to the official site, Matz was “trying to make Ruby natural, not simple,” much like life itself. He adds: “Ruby is simple in appearance, but is very complex inside, just like our human body.”
One of the ways this becomes apparent is Matz’ emphasis on user interface design. Few would think of good interface design principles when talking about developing a scripting language, but Matz believes that all computer systems should start by considering the human element and working around that.
As a result, the language is designed to minimize confusion as much as possible, trying to abide by the principle of least astonishment (POLA). This is in direct contrast with many other languages that continue to confuse their users even after years of use.
Thanks to these design elements, Ruby is generally considered to be relatively easy to learn.
Interpreted vs Compiled
It’s important to remember that Ruby is an interpreted language, not a compiled one.
When many new developers think of developing software, they image coding away and creating, or compiling, the fruit of their labor into a standalone application. They are envisioning how a compiled application works.
True to the name, applications written with these kind of languages are compiled into native code that runs on the target computer or platform. Some examples of compiled languages are BASIC, C, C++, COBOL, Java, Objective-C and Swift.
In contrast, Ruby is an interpreted language, relying on an interpreter to run. Instead of compiling the programming code into a standalone application, an interpreter takes the code and translates it on-the-fly.
There are both advantages and disadvantages to this approach. Development is generally faster and much easier. Similarly, fixes and changes can be implemented quickly, without the need to completely recompile the entire application.
On the other hand, because the program is being translated line-by-line, on-the-fly, interpreted language applications rarely offer the same performance as compiled ones.
As with most things in life, however, things are a bit more complicated. While Ruby is designed as an interpreted programming language, that doesn’t mean it can’t be compiled. There are a number of frameworks, such as MacRuby, that are designed to compile Ruby into native code to run on macOS.
How Do Developers Use Ruby?
Because of its nature and design, Ruby is used for a wide variety of purposes.
One of the most popular uses for Ruby is developing web applications. Especially when combined with a framework, such as Ruby on Rails, Ruby is used to quickly develop, prototype and deploy web apps faster than many competing languages.
One thing is certain: Ruby is a powerful language that offers a unique approach to programming and development. The language has grown in popularity over the years, thanks in large part to the power, flexibility and ease-of-use it offers.
As one of the most popular languages in use today, Ruby shows no signs of slowing down. New developers looking for an area to specialize in, or established developers looking to broaden their skillset, would do well to invest in Ruby. Check out the official documentation to get started.