Why Ruby is great

Posted by Christian Noack on 2018-06-27
Words 1k and Reading Time 6 Minutes
Viewed Times

The Ruby programming language is a dynamic, open source language with a focus on simplicity and productivity (taken from ruby-lang.org). This is totally true and I would recommend it for use in professional software development projects, mainly due to the following attributes of the language:


Ruby is an object-oriented language - well, mostly.

irb(main):003:0> 17.class
=> Integer

irb(main):005:0> true.class
=> TrueClass

Every object is an instance of a class. There is no need for special handling of primitive types.

There are also non-OO leftovers where Ruby acts more as a script language, e.g. puts "Hello world". Some people like it, because it gives you the speed of development script languages are known for. I don’t, because it breaks the OO paradigm, but paradigms and their constraints have advantages. I recommend watching Robert Martin’s contribution to the ACCU 2011. Nevertheless the non-OO parts of Ruby do not get into your way that much.

Brevity and Syntax simplicity

For the OO-part it’s always object.message(params), no surprises and easy. You can even leave out the paranthesis, if you like:
7.pow 2
For the script part of Ruby it’s always methods params. You can use parenthesis here, but they are usually left out:
puts "Hello World!"

Strong Collection Framework

In an object oriented setup the smallest entity of data is an object (derived or instantiated from a class). In modern application development we usually handle larger amounts of objects. They are kept in lists, sets or key-value-pairs. In Ruby these are represented by Arrays, Sets and Hashes. The contents of a collection do not have to be all of the same type.


irb> [1,2,3].class
=> Array


irb(main):087:0> my_set = Set.new([1, "Orange", true])
irb(main):088:0> my_set
=> #<Set: {1, "Orange", true}>
irb(main):089:0> my_set.class
=> Set


irb(main):030:0> {name: "Walter", age: "17"}.class
=> Hash

All collection classes derive from the same parent Enumerable and therefore the most important methods are available for all of them. Enumerable provides strong methods for iterating, sorting, filtering, mapping and reducing collections.

irb> {name: "Walter", age: "17"}.each { |k,v| puts "key: #{k} and value: #{v}" }
key: name and value: Walter
key: age and value: 17

my_collection = [1, "a", true, "much longer", {name: "Walter", age: "17"}]
irb(main):079:0> my_collection.each { | entry | puts "entry: #{entry}" }
entry: 1
entry: a
entry: true
entry: much longer
entry: {:name=>"Walter", :age=>"17"}
=> [1, "a", true, "much longer", {:name=>"Walter", :age=>"17"}]

irb> walter = {name: "Walter", age: 17}
irb> doris = {name: "Doris", age: 43}
irb> users = [walter, doris]
irb> users.select {|user| user[:age] < 20}
=> [{:name=>"Walter", :age=>17}]

This is just a very small number of examples. They give an impression of how strong the colleciton framework is. It resembles the one provided by Smalltalk a lot and it’s as powerful as the implementation in Elixir and other Lisp-based languages. In current versions of Javascript you still have to rely on the excellent Lodash to get this level of collection support.


Ruby-on-Rails is a mighty framework for building server side rendered web applications. This framework made Ruby big. It provides everything a web developer needs to build a web application in a concise and understandable way. The very best about it is:

If you know one Ruby-on-Rails project you know all of them!

This is an important attribute to be considered when selecting the programming language for a project.
The database integration in Ruby-on-Rails projects is done by ActiveRecord. It gives you an easy way of mapping between your application’s objects and the database, especially for relative databases. If the database evolves with your application, you can manage the database schema in Ruby in so-called migrations. I strongly encourage you use them, because they allow for a database schema versioning that is coupled to your code.

Dependency/Package Management

The dependency management in Ruby is organised by bundler. The libraries you are using are called gems and they are configured in an easily readable Gemfile. There a tons of gems available for almost every aspect of development you can think of. The handling of dependencies in Ruby is lightweight, simple and works great most of the time. It is way more reliable than the often beefy Java dependency management with maven.

Simple and Perfect Development Setup

Getting ready for Ruby development is easy. You just need a Ruby installation (please use rvm or asdf to make it even easier) and an editor. That’s it. No IDE needed (but there are good ones you can use) - a vim, emacs, atom or sublime will get you going. There is a wonderful read-evaluate-print-loop for Ruby, called IRB and an even better one for Ruby-on Rails, called rails console. Both allow you to evaluate ruby code on the fly and to debug your application, step-debugger included.


Ruby is a great choice for a software development project, especially for web applicaton development. In Ruby-on-Rails projects team fluctuation has lesser impact than in other technologies. A Ruby project is well-structured, simple and small in comparison to other languages, like Java. The language is mature, but not outdated. I suggest to give it try.