Newsletter: The Front End

Datetime:2017-04-18 05:52:26         Topic: Ruby on Rails  JavaScript          Share        Original >>
Here to See The Original Article!!!

Front End

Issue 13 ~ 4/14/2017

It's been over 10 years since Rails popularized the MVC pattern. A lot has happened since then. Front-ends have grown and grown and grown. Clients who used to be happy with a few effects from now want single-page applications (SPAs). In this brave new world, what are we to make of the pitiful little "V" in "MVC"?

I think the answer is that it's still up in the air. You need only look at the JavaScript framework churn of recent years. But a few patterns have started to emerge and I think it will be interesting to examine them.

La la I can't hear you!

Traditional page-based web apps still work. I feel silly saying this. But we've reached a point where new developers are surprised to hear that a performant website is just a website.

Moreover, the tools we have to progressively enhance web applications have gotten really good. Approaches like Turbolinks give us a lot of the benefits of SPAs at a fraction of the cost.

Granted, these approaches aren't "cool" anymore, and Turbolinks was definitely overhyped. But they do work very well and let small teams look like big teams, which is what Rails has always been about.


Organizing JavaScript With Turbolinks

Turbolinks works well as long as you organize your JavaScript the right way. This article shows you a very simple approach.


Turbolinks 5: I Can’t Believe It’s Not Native!

Learn how Basecamp uses Turbolinks to allow their small team to deliver SPA-like performance on web and mobile.


Your Front End Framework is Overkill - Server Side Javas Script w/ Rails

By combining Rails' unobtrusive JavaScript system with server-side JS views, you can very easily ajaxify normal CRUD operations.

Growing JavaScript

No matter what kind of application you have, as the amount of JavaScript you maintain grows you'll need to come up with a way to manage it.

The Rails Asset Pipeline provides a way to concatenate and minify JS assets. But at some point you may want to switch to a JavaScript module bundler.

Fortunately Rails 5.1 has made this easy for us by integrating with Webpack . It's a little like bundler and the Asset Pipeline had a baby.


Webpack: When and why to use it

If you don't have a clear idea of what Webpack is, or why it might be useful to Rails developers, here's a great introduction.


Using Webpack with Rails

This brand-new video shows you how to use Webpack in Rails. It's a little different from using it by itself.

Front-end achitecture

The nice MVC pattern of Rails isn't very useful when 90% of your code lives in a single "view." In that case, we need to have a separate architecture just for the front-end.

Early JavaScript frameworks tended to follow a MVC approach, or its close cousin, MVP . More recently, we've begun to see the ascendence of a new group of "unidirectional" architectures.


Is MVC dead for the front-end?

This article lays out several of the challenges facing MVC.


Unidirectional User Interface Architecture

Many of the more recent JavaScript frameworks, such as React, use a 'unidirectional' architecture instead of an MVC approach. This article explains what that means and what its advantages are.


Inside Glimmer: Ember's Rendering Engine

The team at Ember recently released their rendering engine, Glimmer, as a stand-alone project. This talk explains its architecture (which includes unidirectional data flow) and why it's better than what came before.

Parting words

MVC, championed by Rails, has come to dominate server-side web applications. It's still too early to tell if any architecture will come to dominate front-end web applications in the same way.

I suspect that the answer is that there won't be. The variety of use-cases for front-end JavaScript seems to be too great for any one approach to win. In either case it'll be entertaining to watch!

Next week we're going to dive to a lower level and talk about some of the protocols that make all of these new-fangled internet doohickeys work. Stay tuned!