Muhammad Yana Mulyana

Why Rails is Still Relevant in 2019 - REPOST

You might have read the infamous blog posts titled “Rails is Dead”, but I have seen development teams flounder over and over again when they try and reinvent the wheelusing NodeJS on the backend.

Rails is Scalable

Despite the negative press, I’ll argue rails does scale.

After developers at Twitter have spoken at length about their issues with Rails performance, it’s easy to get the wrong idea.

Rails is not the fastest framework in the world… but I will argue that performance is the last thing you should worry about when you want to scale.

In my experience, NodeJS or projects written in other frameworks start to collapse architecturally after an alarmingly small amount of complexity is added to them.

More important than how many requests you can serve per second, is how your development team can maintain productivity over time.

With the strong opinions and emphasis on code quality, Rails applications continue to remain relatively healthy and concise when compared with their brethren.

The hard cold fact of the matter is: CPU cycles are cheap. Developer hours are not. If your company and product are in their early stages of development I can almost promise you that the costs of poorly structured spaghetti code will far outweigh your hosting costs.

As our Lord and savior Uncle Bob says: the only way to go fast is to go well.

 

 

Rails is Opinionated

Rails is one of the most opinionated frameworks there is. Creating opinions in a development team is labor-intensive and wasteful. Trying to come to a consensus on the most arbitrary of decisions can be frustrating.

Where should we put files relating to our data model? /app/model!

Where should we put our config? /config

Our email code? /app/mailers

Decision made. Conversation over. Now let’s get back to our desks and write some code!

Having an opinionated framework to lean back on is a breath of fresh air. If you know rails, you can instantly be productive in a new codebase. It’s easy to hire and onboard new developers because they are already familiar with the conventions.

Database Management and Tooling

Database management is hard. Managing database schemas and migrations is hard.

Rails provides you with a no-nonsense way of defining your database structures, as well as a full suite of CLI commands for migrating, resetting, seeding, dropping and creating databases across all environments.

Just look at how simple and clear Rails migrations are:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
class CreateBookItems < ActiveRecord::Migration[5.2]
  def change
    enable_extension 'hstore' unless extension_enabled?('hstore')
    enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto')

    create_table :book_items, id: :uuid do |t|
      t.belongs_to :category

      t.string :name, null: false, index: true, unique: true
      t.text :description
      t.string :tags, array: true
      t.float :price, default: 0

      t.hstore :metadata

      t.timestamps
    end
  end
end

Rails handles databases in a ubiquitous way. There are database drivers for almost every popular database, and schema management and Object Relational Mapping is handled the same way across all data stores.

JavaScript’s ORM landscape is still too divided. The top data packages feel underdeveloped when compared to the batteries included approach that Ruby and its ecosystem is known for.

Configuration Management

Item 3 of the 12 factor app is configuration management.

Rails has multi-environment support built into the framework, with sane defaults and safety checks across testdevelopment and production stages.

Rails also has great support for environment variables using the dotenv library or similar.

Because the NodeJS ecosystem is so fragmented, it is common to see libraries use entirely different configuration styles and it is frequently frustrating to try and massage them to work nicely together.

Rails (and Ruby) Have a Deep Culture of Code Quality

Writing clean, readable code has always been in Rails’ DNA. The language of ruby itself was designed with clear and concise code as the primary design principle.

Often people, especially computer engineers, focus on the machines. They think, “By doing this, the machine will run fast. By doing this, the machine will run more effectively. By doing this, the machine will something something something.” They are focusing on machines. But in fact we need to focus on humans, on how humans care about doing programming or operating the application of the machines. We are the masters. They are the slaves.

Matsumoto - the creator of Ruby

Rails automatically generates tests as you build code, encouraging developers to write well-tested, clean code.

Some would argue that Ruby and Rails were the combination that pushed TDD and BDD principles into the development lime-light.

Quora: Why does TDD seem to be more prevalent amongst Ruby developers than Javascript developers?

Asset Management

The Rails team have put a lot of time and effort into creating simple (but powerful) ways to manage assets in a modern way.

Javascript’s webpack is notoriously difficult to configure.

Thankfully Rails has included another “batteries included” approach with the asset pipeline.

Ruby is a Pleasure to Use

Ruby as a language is simply gorgeous.

1
2
even_numbers = [1, 2, 3, 4, 5].filter { |el| el.even? }
even_numbers.each { |el| puts "#{el} is an even number" }

It gets out of your way, supports flexible and concise metaprogramming, and has a fantastic standard library.

Not to mention one of the best package management tools in the industry!.

RSpec is the Gold Standard of Testing Tools

RSpec is quite simply the gold standard for behaviour driven development, and almost single-handedly created the BDD movement that is still raging in the industry today nearly a decade later.

A Smorgasbord of Plugins

Almost no other framework can boast the shear number and range of plugins.

Rails is all about getting on your feet quickly and being ultra-productive by leveraging it’s OpenSource community. Rails provides you with the tools (and the documentation) to get up and running immediately.

Heroku

While certainly a bit expensive when compared with AWSGoogle Cloud Platform or other solutions, Heroku is something entirely unique.

Heroku embraced Rails’ “batteries included” philosophy and revolutionized development operations almost overnight.

By providing a single-command deployment and effortless plugin system, Heroku enabled developers for the first time to deploy and manage large, enterprise-level infrastructure with a simple and quick GUI.

Rails was and still is their champion framework.

ActiveAdmin

One of my personal favorite aspects to Rails is the automatic tooling for generating admin and back office tools.

Perhaps the best is ActiveAdmin. Well-supported, secure, and with smart defaults; ActiveAdmin allows developers to scaffold complicated admin GUIs with just a few lines of code.

Just point the tool at your database table, list a few fields and define the layout and POOFyou have yourself a personalised data management tool. Download one of the free themes and you’re free to move on and develop your project instead of wasting time building tooling.

Industry Proven

Rails is battle-hardened and industry-proven. There is a long list of (very) successful businesses building their product with Rails.

Twitter, AirBNB, Github, Kickstarter, DigitalOcean, Groupon, SlideShare, Urban Dictionary, Couchsurfing, Basecamp… and many more!

Rails is secure, open source and ubiquitous. The talent pool is deep. The framework is mature. The community is vibrant.

 

source from https://devbrett.com/2019/03/why-i-believe-rails-is-still-relevant-in-2019.html