Ruby as elegant as ballet

Tags: ruby, react, webdev, beginners
Published: 2020-11-16 20:58:30

Okay, I have no idea about ballet but seems very elegant.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ikksv0jifo64rao6ghn6.png)

It has been 4 full months since I started coding as an aspiring web developer and have been exposed to plain and vanilla JavaScript, React JS and Ruby on Rails. After I heard about there is going to be a Ruby on Rails week at my bootcamp I watched 4 hour Ruby video on Freecodecamp by Mike Dane.

Also, I had some exposure to Python for data cleansing. So, I had some idea about JS, Python and Ruby by now. Ruby struck me as some kind of magic. It seemed a lot of things are implied. For example, in order to return a variable from a function you have to do this in JS:

```
const addition = (a, b) => {
    return a + b;
};
```


In Python same code would be the following:
```
def addition(a, b)
    return a + b;
```
In Ruby it would be:
```
def addition(a, b)
    a + b
end
```
And, lastly I want to show you in C++
```
#include <iostream>
int addition (int a, int b)
{
  int r;
  r=a+b;
  return r;
}
```
By the way, it is in my bucket list that I will learn one of the lower level languages one day.

Okay, syntactically what do you think looks the best? I would say Python and Ruby comes very close. However, what is with the word “return”? If I am writing a function, isn’t it obvious that I want something out of the function? Why do I have to explicitly tell you the program I need something out of it?

Also, mind that Python is an indentation sensitive language. Meaning that if I have to worry about colons or semicolons in JavaScript, I have to worry about how many tabs or spaces I insert in Python. Ruby solves this with “end” keyword. Of course, you want to know where something starts and ends.
However, Ruby’s strength comes with Rails. Rails is a web application framework written in Ruby and it is server rendered compared to other JS based frameworks such as React or Angular which are rendered on client-side. It is not to say that JS based frameworks and back-end solutions such as Node or Express can have such capabilities, but Ruby on Rails seems to do it seamlessly and has all the necessary tools to make it happen automagically out of the box.

On the ranking from Hot Frameworks, it is still in the top-10.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wrn543eevroinju4oe39.png)
Source: https://hotframeworks.com/ Accessed on 11/14/2020

So, let’s hear from both sides.

## The biggest myth: Ruby on Rails is slow.
AirBnB, GitHub, Hulu, SoundCloud, Shopify and Bloomberg runs on RoR. If you have used their services or accessed their website, did you notice any difference compared to other websites such as LinkedIn, Netflix or Paypal? I didn’t.
Turns out if you plan your architecture and database well enough RoR can be fast too. That is why well written code is essential for any website or web service. Due to seemingly easy and fast way RoR provides, many new developers make unwise choices and cause the whole thing to run slower.
But honestly, though, if you are building a large-scale industrial level application, of course you want to have efficient and well written code and optimize speed. Thus, it is just a matter of handling the power of RoR in a right way.

## It’s not on the bleeding or cutting edge
One of the strangest thing I noticed was that programming languages or rather frameworks come in trend and goes out of favor time to time. Suddenly one framework is hyped and “dies” after few years. Turns out it works just like a universities like how good universities attract good students which will attract good professors and better employers. Good engineers come up with more abstracted away frameworks with large corporate backing, and attract other developers. Hey, this was developed by Google and has fancy documentations or was developed by Facebook and has cool color, so it must be good right? Not necessarily.

Being mature and not on the beta means that there is nothing under the sun it can’t do that new kids can. I could count 17 versions since React JS was first released 7 years ago. On the other hand, there has been 6 versions of Ruby on Rails in 15 years. Do you want to keep learning new ways to do same stuff every few months? How many legacy does all the version releases create?

## Server side vs. client side rendering
All the new hype about client side rendering is where websites sends you bunch of JavaScript files and your device with its own capability needs to run it to make it work, and you’re supposed to have faster user experience has some major downsides.

For one, some users don’t want to enable JS on their browser. Second, depending on the device’s hardware capability, some cool new feature may take a whole second to run. What is the problem with this? They will leave a laggy website. Third, for search engine optimization, Google bot might visit your site and leave your site before all the JS loads after it crawls and indexes your site.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6atv91cpojjqmzj4guxc.png)
Google crawler

## Conclusion: Chasing a trend
How many lessons a young or new developer have to go through until he or she realizes that chasing a trend is easier when your fundamentals are strong. At it’s core web technologies or sites will have to run a server. On top of its object oriented approach with Ruby, Ruby on Rails provides full-fledged/full-stack tools to build a site or a web app out of box. Thus, if you learn how to do things in Ruby on Rails, you can learn any trendy technologies. All in all, Ruby on Rails gives you strong fundamentals to build on and to build things. If you’re planning a long and prosperous career as a developer, you must have rock solid foundations, and Ruby on Rails provides it.