1. Computing

What is Ruby?

By

What is Ruby?

Ruby is a programming language. You'll often see a number of buzzwords accompany the "programming language" phrase, but those will often impose preconceived notions of what those words should mean on to Ruby itself. Above all else, Ruby is a programming language.

The Good

Ruby is an object oriented programming language. Everything in Ruby is an object, so Ruby is an object oriented language in the purest sense of the word. It isn't like C++ or C# where you have object types and value types, or even Java where most things are objects and a few native types must be "boxed" in order to be treated like objects, everything in Ruby is an object.

Ruby is a dynamic programming language. Many programming languages have a notion of "compile time" and "run time." Those are two different universes, the compiler knows completely different things than the runtime environment. Ruby, on the other hand, makes no distinction. Everything in Ruby is decided on at the last conceivable moment. If you want to call the method called foo on the object called bar, Ruby not only has to look up where this method lives, but it has to look up where the object bar lives. This is in contrast with languages like C, where the compiler knows the exact address and type of objects as well as what methods it has and their addresses.

Ruby is a programming language for the world wide web. While not strictly true, a number of libraries such as Sinatra and Rails make Ruby an ideal language for programming web applications. Many people have only ever heard of Ruby in the context of Ruby on Rails, Rails has been Ruby's "killer app" for quite a long time now. Ruby also makes it quite easy to act as a web client for writing scrapers, spiders and many other non-browser web denizens.

Ruby is a scripting language. The term "scripting language" is very often misused or misinterpreted. Many people take it to mean "interpreted" or "non-compiled" language. While Ruby certainly is this, it is also a proper scripting language, meaning it can be embedded in other programs and be used to control them. A perfect example of this is Google Sketchup, Ruby is used as a plugin interface to programmatically control both the program and the 3D models drawn by the program. While there are some other easier scripting languages to embed, Ruby is still a solid and full-featured choice for a scripting language.

Ruby is free. Ruby doesn't cost anything to download or use for any purpose. Not only is the official Ruby interpreter free, but there are several other free Ruby interpreters for various platforms. There are no tricks, it's not a trial version, Ruby is free. Ruby is also free software, meaning any user of Ruby is free to see and modify the source code according to their needs.

The Bad

These were all descriptive and good things about Ruby, how about some of the uglier parts?

Ruby is slow. Compiled code from languages like C++ or C# absolutely smoke Ruby. Even other languages in the same class as Ruby such as Python or Perl can often be much faster than Ruby. However, the "Ruby is slow" adage comes from a time when Ruby was really, really slow. Prior to Ruby 1.9.x, Ruby was significantly slower. The current version as of this writing, Ruby 1.9.3, is quite fast compared to previous versions. So take this adage with a grain of salt and don't assume Ruby will be too slow for your needs, run some benchmarks first..

Ruby is an object oriented programming language, but only an object oriented programming language. If you don't like object oriented programming, it might be wise to stay clear of Ruby. Some other languages, such as Perl, try to be accommodating to all programmers. If you don't like OO programming, that's OK, there's more than one way to do it. But not Ruby, it's more or less OO or nothing.

Ruby is trendy. Trendy programming languages come and go. Ruby's popularity skyrocketed around 2005 when all of the Ruby on Rails fervor was happening. It was seen as a "trendy" programming language by many, and wouldn't stay popular for long. While we don't know if Ruby will still be around 10 years from now, the amount of Ruby code being written for Rubygems and on Github certain suggests it's genuinely popular and will be around for quite some time.

Ruby is not as popular as other languages. There are Ruby jobs out there, plenty of them. But there are many more PHP and Java jobs out there. If you're learning a language to find a job, Ruby might not be the best choice. However, at least in this author's opinion, you'll have a lot more fun with Ruby than any of the other choices.

  1. About.com
  2. Computing
  3. Ruby
  4. Beginning Ruby
  5. What is Ruby?

©2014 About.com. All rights reserved.