Why Choose Ruby?


By

“The goal of Ruby is to make programmers happy.” ~ Yukihiro Matsumoto

Anyone who wants to create their own application faces the challenge to select a programming language. The choice is huge and it reminds the situation when experienced generals decide what kind of weapons to employ for their operations. Different types of armed forces can achieve the desired result but each of them has its specifics.

Using aviation and heavy artillery allows architects and designers to fully realize their creative visions afterwards. At the same time, light troops can conduct “sweep and clean” operations and leave suitable for living areas – only cosmetic repairs are required.

The same thing is about programming languages: in the sphere of web applications development, there is always at least 2 or 3 languages capable to cope with the task. However, each of these languages may use a slightly different approach to the problem which brings up the question of development priorities and individual preferences. It makes sense to choose the language that provides better tools for maintainability, optimization and scalability of your application.

ruby programming language logo

The Essence of Ruby

Developers apply Ruby in dozens of areas – administration, prototyping, research, development of games and various applications, writing scripts, etc. Cisco, NASA, HP and many other companies use this programming language. Ruby perfectly works on nginx, Apache and there are even web servers written in the Ruby.

Ruby is a well-balanced language. It was created in 1995 by Yukihiro Matsumoto. He combined features of different programming languages such as Perl, Lisp, Smalltalk to form a new one that would be natural but not a simple language. It is a high-level object-oriented programing language which is also fully interpretable. The interpretability means that the program code is stored in plain text which is transmitted to the interpreter that executes it.

Elegance

The cleanliness and beauty of Ruby code are achieved owing to the fact that programmers follow some principles:

  • Do not repeat yourself. By writing code once and putting it in the right place, we protect ourselves from the code duplications and from unnecessary work.
  • Conventions over Configuration. A lot of methods have already been written and they are ought to be used. In extreme cases, when the defaults do not suit us, we simply rewrite them for ourselves. All for clarity and conciseness of code and all these with minimal efforts.

Objects

In Ruby, everything is the object. For each piece of data or code, their own properties and actions may be defined. In object-oriented programming, properties are referred as object variables and actions – as methods. Ruby can easily demonstrate the object-oriented approach by a line of code, which applies an action to a number.

   10.256.round
    # we will get a round number 10

In many programming languages, numbers and other primitive data types are not objects. Ruby, influenced by Smalltalk, allows you to define methods and object variables for all data types. This simplifies the use of Ruby, since the rules applicable to objects are applicable to the entire Ruby.

Flexibility

Ruby’s flexibility is amazing – it allows users to delete, override and modify the basic parts as they wish. Ruby aims to give the programmer as much freedom as possible.

Ruby deliberately supports only single inheritance, unlike many other object-oriented languages. This language gives us the concept of modules (traits – in Scala, categories – in Objective-C). Modules are collections of methods. Classes can freely mix in a module and receive all its methods. For example, any class which implements method each may mix in Enumerable module. This module adds a number of methods that use each to create cycles.

class Collection
  include Enumerable
end

Portability

Ruby was developed mainly on GNU/Linux but it has a high portability – there is a possibility to work on many types of UNIX, Mac OS X, Windows XP/7, and so on. One more benefit – Ruby/Rails now provides the implementation of almost all successful technologies and approaches to programming, such as work with databases via ORM (ActiveRecord), design templates (Design Patterns), development through testing (TDD), full implementation model of MVC concept, using jQuery JavaScript framework.

Openness

The openness of the community is one of the most important strengths of Ruby. If you found a solution to the problem and wrote a useful module you can publish it in the open access and help others. At the moment, thanks to contributions of many people, we have access to thousands of ready-made solutions of various problems.

You do not need to bother about development of standard tools – share-buttons in social networks, sending emails, making up test data, authorization and authentication systems, comments, etc., it is all created, tested and works perfectly. Even if you do not like a part of the library, you can write it by yourself and share it with the community – may be your idea is in high demand right now.

Bottom Line

A rich selection of tools is always good but the wider the choice, the harder it is to make a decision. Ruby is not the only one programming language in the world and all of them have strengths and weaknesses. I do not deny the possibility that a more perfect tool may exist but when I program in Ruby I feel ease and pleasure. I like Ruby!

Related Topics


Top
This page may contain affiliate links. At no extra cost to you, we may earn a commission from any purchase via the links on our site. You can read our Disclosure Policy at any time.