My opinion about Ruby on Rails
Posted onAfter using Ruby on Rails for about two years professionally I can say that is an efficient and practical framework for building web applications. Let me explain why, starting with Ruby. According to Wikipedia. Ruby is an interpreted, high-level, general-purpose programming language which supports multiple programming paradigms. It was designed with an emphasis on programming productivity and simplicity. In Ruby, everything is an object, including primitive data types. It was developed in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan. The beauty of Ruby is that when you are writing Ruby code it feels like natural English, even his creator mentions the following: Ruby is simple in appearance, but is very complex inside, just like our human body — Matz Ruby is idiomatic programing language. Ruby has a great dev experience in terms of writing code, Let’s break out this into some examples. Conditions:
<code> if <condition>
# example
puts 'welcome' if authentication.success?
<code> unless <condition>
# example
user.update_score unless user.is_admin?
Loops:
until <condition>
<code>
end
# or all in a beautiful line
<code> until <condition>
# Another example:
10.times do |number|
next unless number.even?
puts "Even number: #{number}"
end
All of this is extended to the Ruby on Rails framework as well. Look at this example to determine a record’s existence.
if Song.exists?(user_id: user_id, album_id: album_id)
When you see Ruby code you will able to understand it very quickly for its clean syntax, which is nice to increase your productivity during the sessions of writing and reviewing code.
Key aspects that makes Ruby on Rails so productive for building web applications.
• Ruby on Rails is a framework released in August 2004, almost two decades from the time that this post was written. This means that there was a lot of evolution in the framework, many improvements and best practices applied to it over the years that make Ruby on Rails a robust and madure tool.
• Ruby on Rails is an MVC framework that is according to Wikipedia the following:
Model view controller is a software design pattern[1] commonly used for developing user interfaces that divides the related program logic into three interconnected elements. This is done to separate internal representations of information from the ways information is presented to and accepted from the user.
◦ A model is a Ruby class that is used to represent data. Additionally, models can interact with the application's database through a feature of Rails called Active Record.
◦ The views handle the presentation of data, including HTML, CSS, and JavaScript, following the controller's instructions.
◦ The controllers guide the flow of information, querying models for data and coordinating with views to display it.
• Convention over configuration means as long as you follow certain conventions, you do not need to add additional configuration. For instance If you follow naming conventions, like having a User model in app/models/user.rb Rails automatically handles file loading and assumes the database table name is users. No extra setup required.
• The Rails Active Record allows you to efficiently handle the database interactions, is complicated to find something that you can not do with Active Record regarding the database.
• Ruby on Rails has many libraries out of the box for common situations that as developers we need to do for instance, Action Mailer for sending mails, Active Job for background jobs, Active Storage for uploading files to a cloud storage services, Rails testing and so on.
• Ruby's official documentation is a valuable resource because it contains well-written and comprehensive information. Additionally, there's plenty of great external content available.
• A huge ecosystem of well-designed and tested external libraries and tools that you can use in a Ruby on Rails application.
"Wrapping up my thoughts on Ruby on Rails: It's a powerful and user-friendly framework that has made web development a breeze for me."
Sources:
• https://thoughtbot.com/ruby-and-rails-idioms
• https://en.wikipedia.org/Ruby-lang
• https://api.rubyonrails.org/method-if-exists
• https://en.wikipedia.org/m–v–c
• https://guides.rubyonrails.org