Ruby, named after the jewel, is considered to be the successor of Perl. Although very successful in Japan, it is not so well known in the West yet but this could change in the years to come. Ruby is a simple and powerful object-oriented programming language. Below is a sample code:
attr_accessor :name, :age # attributes we can set and retrieve
def initialize(name, age) # constructor method, to create a new Person
@name = name # store name and age for later retrieval
@age = age.to_i # (store age as integer, in case it’s a string)
def inspect # This method retrieves saved values in a
“#@name (#@age)” # readable format
p1 = Person.new(‘elmo’, 4) # elmo will be the name, 4 will be the age
p2 = Person.new(‘zoe’, 7)
puts p1.inspect # This prints our people, using the
puts p2.inspect # “inspect” format defined above
So what are the advantages of Ruby? Well this new programming language is very powerful in that it combines the pure power object-oriented power of Smalltalk with the expressiveness and convenience of a scripting language like Perl – more can be done in fewer lines of codes.
The second thing about Ruby is that it is simple because the syntax and semantics are intuitive and very clean.
And the third but not last advantage is that Ruby is Open Source which means that it is freely available for development and deployment. Moreover you can run Ruby under Unix or Linux, Microsoft Windows, or specialized systems such as BeOS and others.
Having said all this, it is good to know the limitations and disadvantages of Ruby as well. First of all Ruby is interpreted and not compiled. This has a massive effect on performance because compiled programs run a lot faster. The second main drawback comes when you try to code desktop applications to distribute to people. The applications will be a lot slower than if it was written in C++ and the file size will have a few hundred k to a whole megabyte of overhead.
If you would like more information on Ruby, please visit the official website at http://www.rubycentral.com/