Ruby on Rails vs Express.js: A Ruby Dev Shop Owner Perspective
Jan 20, 20218 min read
Co-founder and CEO of Ideamotive. Entrepreneur, mentor and startup advisor.
What is Ruby on Rails?
Ruby on Rails is a framework for fast web development using the Ruby language.
Rails is so closely tied to Ruby that it is sometimes difficult to tell one from the other. But the difference is big: Ruby is a programming language, while Rails is just a framework written for Ruby. Conflicts often occur because of the alignment of these things, especially when developers specializing in Ruby development are hunted as Ruby on Rails developers. It's important to understand that Ruby is not Rails. Ruby documentation is complemented by Rails documentation.
The Rails framework has made a huge contribution to the development of the Ruby language, and it is recently, with the advent of Rails, that interest in Ruby has skyrocketed.
Pros and cons of RoR
Takes less time. It has been estimated that development time in Ruby on Rails is 40-50% less than other programming languages.
The modular design of Ruby on Rails and the application results not only in faster development, but also in the flexibility of these solutions. They can be easily modified, improved or expanded upon release.
Ruby is a concept of consistency in structure and methodology when writing code followed by RoR developers to make interactions between developers easier.
In fact, all of the previous 3 points result in the ultimate cost savings and increased return on investment (ROI).
There are many more JAVA and PHP specialists. It is clear that quantity does not always mean quality. There are real professionals in each of these areas, as well as those who are just starting to learn. Nevertheless, there are fewer specialists here.
Let's be honest and admit that RoR applications are not as fast as applications written in Java or C. However, the truth is that for most Ruby on Rails applications are fast enough. Many high profile companies have entrusted their business to Rails and do not regret it.
What is Express.js?
Express is a framework for Node.js applications.
Express is a minimalist and flexible Node web application framework that provides a rich set of features for creating single or multiple pages and hybrid web applications.
It has a rich API and is very fast.
This framework is well known to evolve in its own way, unlike other frameworks that rely heavily on Rails, but also borrowed a lot from another Ruby framework called Sinatra. The concept is simple: the framework provides ample opportunities to launch and work on the fly, without requiring a lot of preparation time.
Express has been used for application development for a long time and, due to its stability, firmly holds the position of one of the most popular Node.js frameworks.
Pros and cons of Express.js
For this framework, there are a large number of detailed instructions and descriptions that have been compiled by developers who have tested its effectiveness in practice. Therefore, devs recommend to start working with Express if you intend to learn how to create applications on the Node.js platform.
Agree, it is much wiser to use the accumulated and proven experience than reinvent the wheel.
Minimalism + Flexibility
The main feature of this framework is that Express has a small amount of basic functionality. All other functions you need will have to be picked up by external modules.
In fact, Express in its pure form is a server and may not have a single module. Thanks to this minimalism, the developer initially gets at their disposal a light and fast tool that they can expand and develop.
At the same time, it is important that the choice of modules for Express is not associated with any restrictions: neither quantitative nor functional.
As a result, this framework provides the developer with the ability to solve any problem, without limiting their choice of tools.
Also we can mention:
wide range of plug-ins.
Large amount of manual work
On the one hand, it is good news that the lack of ready-made universal solutions actually means that every application you create will be unique. On the other hand, the developer needs to independently select and organize the modules, which requires a lot of work and, accordingly, requires more time and effort from the developer.
Necessity to compile TypeScript
You have to compile TypeScript before using it with Node.js, which complicates things a bit - using the compiler in your toolchain, using the original Maps to figure out where in real code the production bugs have occurred, etc.
RoR & Express - why should we compare them?
More and more people are trying to figure out which framework is best for the back end development. Since many of our readers have never used Express before, we wanted to dive into the differences between Rails and Express.
So, what’s better?
RoR vs Express
Speed of coding
The Convention Over Configuration approach allows developers to get started on real products as soon as possible — with minimal time spent setting up the environment. This is not only convenient for developers, but also directly contributes to the reduction of time to market. It is right! Ruby on Rails comes in handy when you want to build an application very quickly and test your launch ideas in the marketplace. When users arrive, you can collect feedback, observe their behavior, test your early assumptions, and determine the right path for further development.
Winner: Ruby on Rails
Express.js is known for its speed. Thanks in part to a combination of programming oriented events and programming that is out of sync. Plus input / output, eliminating clogging. All this allows the maximum use of one processor core and computer memory.
In fact, Node.js can handle more requests at the same time and, by definition, the load of many web servers. Node.js allows programs to keep running even on request input and output when the server is loaded. Maintain application performance regardless of workload.
Ruby On Rails is leading in most countries, including the US, Russia, Japan, India and 144 other countries. While Express is most popular in China, Brazil, South Korea, Belarus and 7 other countries.
Turning to google trends, we can see that over the past years RoR has had much more search queries.
At the same time, we can say that RoR is much harder to learn that is why the talent pool is significantly reduced. To begin with, there are developers, but they are less numerous than other ones. This is due to a different threshold of entry into mastering the technology (usually people get into Ruby after several years of PHP), which speaks of the quality of the developers.
There are equally few good developers in all technologies.
The combination of Express workers and clusters makes it easy to create additional Express.js processes depending on the workload. This makes it easier to develop Express.js applications. The way this framework is designed means that what you can do is really only limited by the number of server processors you have access to. Make it a good platform if you plan to deploy enterprise applications.
There is a myth that "Rails do not scale”. This is the main delusion of those people who have not tried to write serious projects on RoR. Ruby on Rails scales beautifully.
Take a look at GitHub, Groupon, Basecamp, and more. All of these projects are written in Rails and all of these projects have other problems, but not scaling problems (most often database performance ones).
Community & support
Rails is an open source web application framework supported by an active and supportive developer community. Not only can they help each other out when they run into some issues, but they also ensure that the Rails infrastructure is kept up to date, bug fixes, and security issues consistent with industry standards.
Express is a rather young technology which simply can’t compete with RoR in terms of support.
Winner: Ruby on Rails
Rails' simplicity is deceiving. The learning curve is really small at first, and the sheer number of Rails tutorials and getting started guides make it even easier. But as applications get more complex, it gets harder and harder. If good coding conventions and object-oriented design are not followed, the codebase will be everywhere and impossible to maintain.
After a little learning curve, Express is a good choice for aspiring NodeJS developers to get started quickly.
Express is flexible, but this can be a problem. Sometimes the modules are of poor quality, and the proposed documentation may lack specifications. As a developer, you have a choice of modules with Node.js. And it's not always obvious which module is better. For example, choosing a template engine can take time.
Thus, Express.js is a less out-of-the-box solution compared to RoR. Modules can also be difficult to integrate, but they also contain bugs and cause unexpected behavior for developers. Therefore, it is very important to have an experienced Node.js developer on your team who can help solve problems.
Winner: Ruby on Rails
Cost of development
To begin with, the Ruby programming language is not for beginners. The barrier to entry is high, so Ruby programmers usually come after years of working in any other programming language. The average age of a Ruby programmer is 25-28 years. A regular Ruby on Rails beginner programmer is an experienced web developer with a great deal of knowledge, experience in developing projects in any other language, understanding of programming principles, and an excellent understanding of web development in general.
Because it’s new and very hot, there are fewer developers in the market for Node and Express. However, the ease of learning makes this framework’s talent pool develop fast. Thus the cost for your project won’t be as high as for the same on Rails.
Coverage of Ruby on Rails features in Express.js
The main advantage of Ruby on Rails development is a large set of libs (gems) helping to significantly shorten time to delivery. My question was how mature is Node compared to RoR. I identified popular gems used in our projects and tried to find an equivalent solution in Node. Here is what I got:
ActiveRecord — communication with a database — Basic Rails ORM gem for abstracting manipulation of all popular databases. Crucial for Ruby on Rails coding efficiency. Equivalent: Sequelize — it seems like this lib pretty ordinary mimic ActiveRecord using JS syntax. It handles migrations (with external lib), provides a query interface and allows to build associations between models.
Devise — authentication solution — one of the most essential gems responsible for sign up, log in using a database or one of 800 external providers, password recovery and more. Equivalent: Passport — provides over 300 authentication strategies including basic database authentication.
carrierwave — file upload, management, and image manipulation. Equivalent: the most prominent lib I found is multer, a part of Express.js — it provides very basic functionality — just file uploading to the given directory. Compared to carrierwave it doesn’t provide any file manipulation abstractions.
Searchkick — excellent interface for communication with elasticsearch.JS providing abstraction all basic full-text search needs as well as some advanced features like facets building, autocomplete and suggestions. Equivalent: the only library that I found suitable for comparison is elasticsearch-js but it covers only basic functionality and doesn’t integrate with any ORM as an opposite to Searchkick.
Pundit — provides a simple, flexible yet powerful solution for resource authorization. Equivalent: node_acl — integrated with Express.js and even more advanced than Pundit, however operating on NoSQL databases.
Choosing the perfect technology for your project should always start with an assessment of your problems and needs. Once you understand what they are, it will be much easier to assess which technology will best serve your application.
If you are focused on building your application as quickly as possible, you can opt for Ruby on Rails. A good choice if your project has a tight deadline and budget. However, keep in mind that this decision can have some negative consequences as your application grows - Ruby on Rails is often criticized for performance and scalability issues. Plus, hiring a good RoR developer can be quite expensive in the long run.
If you are measuring high and want your application to scale, or if you are building an innovative web development solution that requires complete control over framework architecture, modules, database integration, and server deployment, then Express.js is the right choice. It is fast, lightweight, and scalable. Combined with the way it handles large files and multiple concurrent requests, it is an especially good choice for all real-time, chat, streaming, or collaboration tools.
Robert is a co-founder and CEO of Ideamotive. Entrepreneur, who with passion spreads digital revolution all around the internet. Mentor and advisor at startup accelerators. Loves to learn and discover new business models.