What is ruby?

Ruby was created in 1995, which is about twenty-six years ago, by Yukihiro Matsumoto.

His aim when designing the language, was to create a scripting language, so scripting as in open this, read that, close this, so scripting as in a language, which is more human readable, and simpler to use than a non scripting language, for example C or java

From the inception of the ruby programming language, Matsumoto wanted it to be object oriented, since he didn’t believe that there existed an object oriented scripting language, and he deemed that python, had OOP fused into it.

So an object is? Well if it is to go into this direction of thought, anything is an object. To understand the object concept furthermore, just try describing the things that you encounter.

So for example, you have a finger, a finger has a length, it has a color, it has width, a depth, all of these are your finger properties or attributes, additionally a finger has a mobility, or a movement function, which is just one of the functions that a finger can do .

Ruby is not only object oriented, but is imperative, reflective, and functional.

Imperative as in the computer doing exactly what it is told to do, so it is just executing your commands, reflective as in introspection can be performed on a piece of code, so as in discovering its defined functions, and attributes, and also modifying its behavior dynamically, as in to get certain functions out of it, functional as in I am designing functions to perform certain tasks.

Ruby was influenced by smalltalk for the OOP side of things, and lisp for the functional side of things, and by perl for the usability side of things.

So having understood, what we can expect from ruby, which is having the ability to write imperative, functional, OOP, and reflective programs, you might ask, is anybody actually using ruby?

Well ruby is a general purpose programming language, so it can be used for anything, some notable usages of the ruby programming language are:

  • The Metasploit framework, which is related to vulnerability testing.
  • Homebrew , which is a package manager for macOS.
  • Vagrant , which is a tool for building and distributing development environment, or virtual machines.
  • CocoaPods , which is a tool to install objective-c, and swift libraries to be used in your project.
  • Rails , a ruby’s web framework, the GitHub‘s website, is for example written using rails.
  • Sass , which is a way of making css programmable, was originally written in ruby.

So ruby is actually mainly used for scripting purposes, and as part of ruby’s evolution, there are multiple ruby’s versions, so nowadays, what is still maintained, is the version 2.7, and 3.0, where 3.0 is backward compatible with 2.7.

Ruby versioning can be understood as follows, the first number is the MAJOR version number, so this number is reserved for special events, and is increased on incompatible changes, which can not be released in MINOR.

The second number is the MINOR version, it may or may not be API incompatible, and it is released every Christmas.

The third number is the TEENY version, it means API compatibility is maintained, and security and bug fixes are being released, this happens every two to three months.

The last number is the PATCH, which is the number of commits, since the last MINOR release.

API compatibility means, that your code can run without further changes, on different versions of ruby.

Ruby is an interpreted language, the difference between an interpreted and a compiled language, is that for an interpreted language, there is a program which is going to execute the code that you have written, whereas for a compiled language, the code that you have written, is converted to CPU instructions, and the CPU is going to execute your code.

With the advent of ruby 2.6, ruby had what is called a just in time compiler, so basically, code which is being used a lot by your program, is compiled into CPU instructions, when the interpreter assesses it must be so, hence part of the code is interpreted, and another part can be compiled and executed by the CPU.

The aim of introducing a just in time compiler, was to have better performance, while keeping the option of having an interpreted language.

The advantages of an interpreted language, is for example, your program can be directly executed, so you can directly assess your code, whereas for a compiled language, and depending on the complexity and size of a program, sometimes you have to wait a lot of time, before being able to execute your code.

If you want to check the popularity of ruby, there are multiple sites, that can be used to check programming languages popularity, as of the time of writing this article:

  • On IEEE , as a general purpose programming language, ruby is ranked 16th, and as a web programing language, it is ranked 9th.

  • On Tiobe , ruby has a popularity ranking of thirteen.
  • On Github , ruby has a popularity ranking of ten.

  • On Redmonk , ruby has a popularity ranking of nine.