Reno, NV    +1 (800)0 621-0871

Go back

Industry | Ruby on Rails

Microservices, ClientMVC, Turbolinks 3 and ActionCable — Why Ruby on Rails is Still The Choice for Innovative Apps

  |  April 29, 2015

RailsConf

Railsconf logo

RailsConf is the premier conference for users of the Ruby on Rails web development framework. It has been an almost yearly ritual for me since 2008 when I attended my first. Through these events I joined an inspiring global community of like-minded open-source software development professionals. I love to see old friends and catch up on their work, to get the pulse of the industry and to learn of new techniques and technical directions.

When I first discovered Ruby on Rails (version 1.1.3), now in it’s 10th year and nearing a 5.0 release, I immediately recognized the uncommon wisdom of the creator of the framework, David Heinemeier Hansson.  DHH’s wisdom showed through the design choices he made and through his talks and presentations.  I am glad to see that he is still very active in development and remains the prime thought leader in our big tent.  His opening keynote showed us why we can expect Rails to remain the go-to framework for a large class of web and mobile applications for perhaps another decade.

State of Web Development 2015

Concern has mounted in recent years in the Rails community as competing frameworks and programming languages emerged and “the Rails Way” became a bit of a murky mess with many choosing to do things differently.  The consensus is no longer quite so strong.  Of the trendy Early-Adopters who flocked to Rails in the early days (I was one), many have moved in different directions, including native app development for mobile devices, Elixir, node, scala and clojure.

What we are seeing now is more and more of the Late Majority arriving to the party.  This is a good thing.  It means Rails has grown up.  I think we have crossed the chasm and reached the point where outside of the most stodgy enterprises “no one will get fired for choosing Rails.”  It is a safe, responsible choice for building substantial, complex and commercially successful web applications quickly and efficiently.  Even while we explore options to see what other good things are out there, I am glad to have built my career and business on Rails.

The biggest change in recent years has been the charge to build heavy client-side Javascript applications and to divide server functionality into groups of cooperating micro-services.  We have had experience with both of these approaches.  Both have major drawbacks, often slowing development rather than speeding it up.  The biggest drawback is that these approaches end up increasing complexity substantially and tend to require larger teams to develop, scale and maintain.  This is costly.

In his keynote this year, DHH, articulated his vision for Rails as the go-to backpack full of curated multipurpose tools for small teams — as small as a solo developer — that set out to build innovative and successful applications from scratch.  This is what always appealed to me so much about Rails — that I could sit down and build something so useful, so quickly.

Over the years, Rails has become more and more of a take-only-what-you-want buffet and many people decide to bring their own dishes, pot luck style.  This is great and it has kept a lot of bright minds happy in our big tent.  However, my long-standing observation is that the magical leverage of incredible productivity dissipates rapidly the more you depart from the methods and techniques of DHH.  In his keynote, David announced the evolution of Turbolinks and the introduction of ActionCable as part of Rails 5.  I’ll briefly describe what these things are and why they are important.

Turbolinks 3

turbolinks-rails
Photo credit: Geekmonkey

Web applications work by constructing web pages on a server and sending them for display in a web browser.  Pages often include Javascript to enhance the user experience.  Interest in single page apps and heavy Javascript (also referred to as “client MVC”) has grown because web connections have become faster and browsers more performant and standards-compliant.  This facilitated the possibility of delivering a web application in a bundle of Javascript which takes partial or complete responsibility for what the user sees and does in the browser.  It introduces a number of sometimes unwelcome challenges.

Turbolinks emerged in Rails 4 as a way to provide a faster, more responsive user experience similar in speed to single page apps while still rendering whole pages on the server.  It is an evolutionary approach that does not ask us to take up an entirely new set of tools.

Turbolinks 3 extends this approach to include partial-page updates and the ability to preserve page regions and elements between pages.  This eliminates many of the advantages people sought in single page Javascript and Client MVC approaches while keeping things much simpler.  We get all the benefit without the pain of dividing our app in two and without the cost of hiring twice as many developers.  This simplicity is a big advantage to a small team or a startup with limited capital.

On the roadmap are native Turbolinks libraries for Android and iOS which will allow easy development of mobile applications without ever leaving the Rails ecosystem.  This means a small team can deliver a web app AND complementary native mobile applications with a great deal less work.

ActionCable

Actioncables

Photo credit: @coderkungfu

Taking things to the next level, many applications would benefit from or require “real-time” connections to the server. Chat applications, status notifications, multi-player games, system monitors — all interact with a world “out there” that is changing in real time.  These applications need to update and change what the user sees without any user interaction.

Developers have long used a “polling” technique where the web browser periodically asks (polls) the server if anything has changed or if there is new information available.  Polling is expensive and slow.  If you want responses in less than a second or to support many, many users, you need to use something better.

ActionCable is Rails’ answer to other systems such as Elixir’s Phoenix framework, which have begun to provide more advanced real-time messaging, and “connected-app” capabilities.  ActionCable provides a simple, easy way for Rails developers to integrate real-time capabilities into their applications.  It looks like a beautiful piece of work.  We built an experimental project several years ago on Rails 3 to provide real-time collaborative story-mapping.  It would have been much easier to build today on Rails 5.

ActionCable and Turbolinks 3 combine to facilitate whole new classes of web applications built on Rails and to lower the cost of experimental and ambitious applications.   These new capabilities will enable exciting new features to existing applications as well.

What’s Next?

These two technologies will help Rails to continue to deliver on the original promise of simplicity and high-productivity.  I intend to use them to deliver more value for clients and customers.

As we get closer to launching our AppExpress service this year, I am excited to dig into the new technology in Rails 5.0 and see what it can do for us and for you.  Through a return to simplicity we can continue to maximize our sustainable pace of value delivery at ÆLOGICA.

Do you have an interesting application idea?  Do you need a team to speed your execution?  Talk to me.