Today I would like to talk about Ruby on Rails, an open source software to build web applications.
When I finished my software engineering degree, I had been learning some technologies like JAVA or PHP, but I had no idea about Ruby on Rails. Since my first job, I have been working with Rails and the beginning was difficult (I did not understand the “Rails magic”) but finally, I realized that it is a friendly technology for developers.
Ok, but… you could ask yourself, what is Ruby on Rails? First of all, you should understand that Ruby is a programming language like Java, PHP, or Python, and Rails is a framework, like Spring (Java), Laravel (PHP), or Django (Python).
We define Ruby as an interpreted, high-level and general-purpose programming language. It is dynamically typed, and object-oriented. Think that everything (strings, integers, booleans…) are objects in Ruby. Take a look to these examples:
my_variable = "Hello, world!"puts my_variable
=> Hello, world!
=> Stringmy_variable = 1puts my_variable
In addition, this language uses a garbage collection, so you must not concern to manage the memory.
If you are interested to learn more about Ruby, check the official documentation.
Ok, at that point you have more or less an idea about what is Ruby. Let me talk about Rails.
Rails is a server-web application framework. It means that you can build web applications using Ruby as a server language under the Rails rules. This framework is based on the MVC (Model-View-Controller) pattern, and some other principles: “convention over configuration” and “don’t repeat yourself” (DRY).
- Convention over configuration: basically you need to follow some conventions to decrease the number of decisions that you, as a developer, need to take. For example,
Usershould be the class name and
usersshould be the database table. It allows that all developers working on the same project use the correct names, and no one uses
usersas a class name for example.
- Don’t repeat yourself: the framework helps to avoid the repeated code, replacing it with abstractions or using data normalization to avoid redundancy.
Another interesting point is the Rails community, and directly related to that, the gems (libraries). Lots of developers have been working on these gems and it is probable that you would not need to implement something because it was implemented in a gem. For example, a famous gem is Devise, which implements a complete authentication system.
For more information about Rails, here is the official guide.
In addition, we should keep in mind that Ruby on Rails is used for some big companies like Airbnb, Basecamp, Github, Shopify, Soundcloud or Twitch.
To finish this article, if you want to learn more, I recommend you to read the book “Agile web development with Rails 6” and check the following link to my personal Github repository where you could find a project based on the basic functionalities related to this book.
Thanks to read this article :)