Why Ruby in 2020?

Why Ruby in 2020?

Are you new to programming or are you someone looking to learn a programming language?

Let's see why Ruby might be a good fit for you.

About Ruby

Ruby is an interpreted, high-level, general-purpose programming language. It was designed and developed in the mid-1990s by Yukihiro "Matz" Matsumoto with programmer happiness as the main idea and intended to make programming fun. It focusses on the fact to make a program to be understood by humans first and computers second.

The popularity of Ruby lies with Ruby on Rails, a web development framework developed by David, which helps in rapid application development.

Why do you need to learn Ruby?

Let's see some reasons as to why you should learn Ruby:

  • Easy to understand the syntax
  • Lesser lines of code
  • Purely Object-Oriented
  • Community
  • Open-Source

Easy to understand the syntax

Ruby's syntax is simple and beginner-friendly that sometimes you can even get confused if you're writing code or just plain English. This provides learners with an easy learning curve while compared to other languages.

irb(main):001:0> "ruby".upcase
=> "RUBY"
irb(main):003:0> [56,34,66,13,44].sort
=> [13, 34, 44, 56, 66]
irb(main):004:0> 2.odd?
=> false

Lesser lines of code

Let's take a classic example of printing Hello world in Java and in Ruby.

  • Java
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, world!");
    }
}
  • Ruby
puts "Hello World"

As you can see, Ruby is less verbose than other programming languages. This lets you focus on writing the business logic.

Purely Object-Oriented

Every value in Ruby is an object, even the most primitive things: strings, numbers, and even true and false. Even a class itself is an object that is an instance of the Class class.

irb(main):009:0> "hello".class
=> String
irb(main):010:0> String.class
=> Class

---

irb(main):011:0> true.class
=> TrueClass
irb(main):012:0> TrueClass.class
=> Class
irb(main):013:0> Class.class
=> Class

Community

Every programmer knows how important community support is for a language/ framework. If a lot of people are using the same technology as you are, you can get a lot of help in finding the solution to the problem you are facing. Moreover, Ruby has been here since 1995, and it has developed and matured a lot over the years.

Open source

Ruby, like most languages, is an open-source as well. It means that you need not pay to use, modify, develop, and distribute software that is built upon it. There are also regular language versions being released to Ruby, with the latest stable release 2.7.1 on October 2, 2020. With every release, the Ruby maintainers have made sure to keep improving the language's speed, security, and cleanliness.

Conclusion

A lot of big giants like GitHub, Airbnb, Shopify run on Rails which in return runs on Ruby. Not just this, even static typing is released in Ruby in version 3.0 preview, the most requested feature by the community.


I hope this article gave you an idea of what Ruby is and why you should learn it. Do let me know in the comments if you are interested in learning it as well. I am thinking of doing a series as well :)

Did you find this article valuable?

Support Sabarish Rajamohan by becoming a sponsor. Any amount is appreciated!