×

Ruby Tutorial

Ruby Basics

Ruby Control Statements

Ruby Methods

Ruby Classes and Methods

Ruby Arrays

Ruby Sets

Ruby Strings

Ruby Classes & Objects

Ruby Hash

Ruby Tools

Ruby Functions

Ruby Built-in Functions

Misc.

Ruby Programs

Ruby overview

By IncludeHelp Last updated : November 16, 2024

What is Ruby?

Ruby is a high-level, open-source programming language created in 1995 by Yukihiro Matsumoto, designed to be simple, enjoyable, and productive. It is object-oriented and widely used for building desktop applications, creating static websites, processing data, automating tasks, managing web servers, supporting DevOps, web scraping, crawling, and developing database-driven web applications.

History of Ruby

Yukihiro Matsumoto "Matz", a software programmer, and a Japanese Computer Scientist developed and designed Ruby in the mid-1990s. There is an engrossing story behind naming the language as "Ruby". An online chat session was taking place between Matz and Keiju Ishitsuka(Matz's Colleague) during which two names were proposed for the language before writing any code on it, one was Coral and later was Ruby. The later one was selected as Ruby was the birthstone of one of the colleagues of Matsumoto.

Ruby 0.95 was the first version of the Ruby which was released in 1995, then various substantial versions were released in the following years:

In 1996, Ruby 1.0 was released.

In 1998, Ruby 1.2 was introduced to the market.

Ruby 1.4 and Ruby 1.6 were released in 1999 and 2000 respectively.

After this many versions were introduced with better features and the latest version of Ruby is Ruby 2.6.0 which was released on Christmas, 2018.

Ruby Features

1. Object-Oriented

Object-Oriented programming used programming standard which employs Objects and their interactions to develop Applications and Computer Programs. Ruby is an object-oriented language with some procedural features. The fundamental features supported by Rudy are:

  • Abstraction: Abstraction is clarifying complex reality by modeling classes suitable to the problem.
  • Polymorphism: Polymorphism simply refers to many forms. An object or function/method can be used in different ways for different data inputs.
  • Encapsulation: Encapsulation is a process of preventing an object from unauthorized access by hiding the values or state of that particular object.
  • Inheritance: It is a way to create new classes by deriving the properties of existing classes. It is like a Parent-child scenario.

2. Supports Mixins and Metaclasses

Mixin is a feature of OOPS which allows Methods of a class to be used by another class without declaring Method's class as the parent class of that class which is accessing its methods. This feature is known as Mixin.

A metaclass is a kind of class whose objects are also a class. An ordinary class defines the behavior of certain instances but a metaclass defines the behavior of precise classes and their objects.

3. Supports Dynamic Typing and Duck typing

Ruby supports dynamic typing which means that the data type of the variable is checked or verified at the run time. Here, most of the times, the type of the variable or object is not specified at the run time.

Duck typing can be simply defined as the process of determining if an object can work for the specified purpose or not.

4. Interpreted Language

Ruby is an Interpreted language which means that most of its instructions are executed directly and freely without prior compiling the program into its native machine or byte code.

5. Garbage Collection

Ruby supports Garbage Collection which is a kind of Automatic Memory Management and means that it allocates the memory to the variable automatically and deallocates the same when memory is not in use. It is the antonym of Manual Memory Management in which the programmer needs to allocate and deallocate memory to the object through instructions.

Advantages of Using Ruby

  1. It has less number of lines of code which makes it an elegant yet powerful language.
  2. It permits easy creation of Web Application which requires fewer efforts and makes programming easy.
  3. The syntax of Ruby is very close to Spoken language thus making it simple to remember and code.

Disadvantages of Using Ruby

  1. It is a scripting Interpreted language and scripting languages are slower when compared to the Compiled languages.
  2. Most of its code is generated at runtime which makes it difficult to be read while debugging.

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.