fbpx

Serverless Ruby and the Future of Web Development

Update: After a great discussion on Reddit, I just want to clarify that this post is about Ruby adoption for web development, not adoption in general. I've changed some titles in order to reflect that. Also, this article does not mean to say that Ruby is dying and Rails is going to disappear. Like many of you, I've worked in a lot of different places. In my experience, I've seen Rails teams adopting other languages when they start building things using a service-oriented architecture, and that's ok. There's no silver bullet, one-size-fits-all solution. As a Ruby enthusiast, my point with this article is to suggest what I think would make Ruby more attractive for modern web application architectures.

The Rise of Ruby on Rails

Ruby was first conceived in 1993 by Yukihiro "Matz" Matsumoto in Japan with the first public release, 0.95, coming later in 1995. It took about a decade for the language to gain popularity. We think it had a lot to do with the with the introduction of Ruby on Rails in 2005. Rails was a perfect complement, as it provided a solid framework to bootstrap full featured applications really quickly. Pair that with Ruby’s simplicity and ease to learn, Rails became a great way for teams to build and bring software to market faster. The framework was a great fit for rapid prototyping and MVP, and so it became a favorite amongst growing startups and web scale companies like Netflix, Shopify, AirBnB, & Github

With the rise in popularity of Ruby came a strong community that developed around the project. Today the project has over 3,000 contributors, and there are over 150,000 open source Ruby libraries (Gems) that have been downloaded over 30,000,000,000 times (source: RubyGems.org.) Ruby is 8th on the the RedMonk Programming Language Rankings.

Some numbers from the latest Ruby on Rails Survey (2018):

  • Over 2000 developers respondents
  • 72 countries are represented
  • 65% of respondents reported they work in a product shop

The Loss of Momentum in Web Projects

The growth of Ruby's popularity peaked in 2008 and started to decline in web development after 2015, as the adoption of Rails for new projects decreased in favour of new modern architectures that were more suited to the cloud.

Browser Popularity & Javascript

Also in the early 1990’s, developers at Netscape who were evangelizing the web browser, created Javascript to become the "glue language" for HTML. from the beginning, the creators of javascript believed that a browser-based web experience would prevail in the long run. As the internet evolved and browsers gained popularity, Javascript emerged as the defacto language to power rich web applications.

Distributed Architectures, Cloud & DevOps

Over the past ten years the industry has shifted towards distributed systems that can be developed faster, and scaled more gracefully. Applications became more complex with more moving pieces, development teams started working more closely with operations (DevOps) and new, more “dev-friendly” units of compute (containers) became the standard for “cloud native” development.

These trends also contributed to loss in Ruby popularity. Rails, arguably the reason for Ruby’s popularity as a web development language in the first place, leverages a legacy monolithic architecture which did not lend itself to these new ways of building web applications.

The Introduction of NodeJS

The first publicly available version of NodeJS was released in 2009. Because NodeJS is a runtime that executes JavaScript code outside of a browser, it allowed developers to use Javascript in the backend. Javascript was already massively popular, with a huge global community of developers, and so it was easy for them to use a common language for both the front end and back end of their applications. Additionally, companies were already employing JS developers to build rich web apps, so there wasn’t a need to retrain or hire new talent. This also created a problem for Ruby in the web industry. Why would you use Ruby for a backend when you could just standardize on Javascript for both backend and frontend?

Ruby’s Comeback  

Despite this history, we are optimistic on the future of Ruby. Sometimes we need to look at the tools we have at our disposal today and reimagine them, rather than creating something brand new.

Check out this great Keynote by Ruby creator Yukihiro 'Matz' Matsumoto at 2018 RubyCof where he discusses his vision for the future of the project

We think Ruby is on track to regain its popularity amongst web development teams. Here’s what Ruby has going for it:

  • It is simple to learn and easy to read so it allows teams to work fast
  • It is mature & feature rich - well maintained by a community of an estimated 74,000 developers globally and it is the language-of-choice at many large and growing web-scale companies like Shopify who contribute to the community regularly.
  • Crystal - a language growing in popularity with syntax similar to Ruby, but fast like C. It is ideal for compute intensive apps. Ruby skills are easily transferable to Crystal so they’re complimentary projects that have a future together (though at the moment, Ruby compatibility is not a goal of the Crystal project.)

To solidify its future in modern web development, Ruby needs 2 critical components:

Ruby needs a turnkey, end-to-end serverless solution - not another framework

Ruby needs an elegant solution for serverless, that brings the simplicity and joy once provided by Rails, while producing web apps that run in a distributed fashion. The solution must incorporate DevOps best practices and provide tools that enhance the developer experience - in tandem with a platform to orchestrate the underlying cloud components, completely abstracting infrastructure away from developers.

Ruby needs to run in the browser

With Web Assembly (Wasm) support for LLVM, we will see a whole new era of front-end development. Developers will create compilers or interpreters that will allow any language to run in the browser. Javascript won't be the only option anymore, as teams will have a choice. Ruby is the easiest language out there, and has an amazing ecosystem of libraries (gems). Once it hits the browser, the tides will turn again.

Wrapping up

It is this optimism of the future of Ruby that inspired our team to build our platform. We’ve talked to the community and feel that there are enough people who share the same vision, and could greatly benefit from Serverless Ruby. This is the specific problem that we are addressing in the short term. At the same time, we feel that the community must push towards bringing Ruby to the browser via Wasm as soon as possible.

Resources: