Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Frontend Choices (RubyConf Portugal)
Search
Alex Coles
October 13, 2014
Technology
480
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Frontend Choices (RubyConf Portugal)
Alex Coles
October 13, 2014
More Decks by Alex Coles
See All by Alex Coles
How a language reflects its people (Brighton Ruby)
myabc
0
120
How a language reflects its people
myabc
0
110
Taking Rails beyond the asset pipeline (Workshop at RubyDay Italia)
myabc
0
90
Rails: beyond the asset pipeline (RubyC)
myabc
0
150
Frontend Choices (Tropical Ruby)
myabc
1
810
Frontend Choices
myabc
0
72
Frontend Choices
myabc
0
310
Putting the Hype back in Hypermedia
myabc
1
250
DataMapper
myabc
2
240
Other Decks in Technology
See All in Technology
データエンジニアリングとドメイン駆動設計
masuda220
PRO
14
2.5k
複数プロダクト組織のAIネイティブ化における戦略 / AICon2026_kude
rakus_dev
0
300
インシデント事例と パッケージの全量解析に学ぶ ソフトウェアサプライチェーンの守り方 / supply-chain-attack-defense
flatt_security
0
890
OPENLOGI Company Profile for engineer
hr01
1
74k
Type-safe IaC for Dart
coborinai
0
180
AIが当たり前の組織で エンジニアはどう育つか
nishihira
1
970
_NIKKEI_Tech_Talk__勉強会は熱量では続かない___17回続いた輪読会の設計術.pdf
_awache
1
100
AI_Dev_Day_製造業領域でのAI活用から見た活用の罠と成功に導く実践知.pdf
kintotechdev
0
160
AIコード生成×サプライチェーン攻撃 — PHPが直面する“二重の信頼問題
shinyasaita
0
460
『モデル + ハーネス』で読み解く AIエージェント入門
oracle4engineer
PRO
2
170
AIとハーネスで育てるトランスコンパイラ / 20260722 Yasushi Katayama
shift_evolve
PRO
3
780
kaonavi Tech Night#1
kaonavi
0
160
Featured
See All Featured
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.5k
エンジニアに許された特別な時間の終わり
watany
108
250k
Designing for Timeless Needs
cassininazir
1
400
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
330
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
260
Thoughts on Productivity
jonyablonski
76
5.3k
sira's awesome portfolio website redesign presentation
elsirapls
0
310
Designing for humans not robots
tammielis
254
26k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.2k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
970
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
420
Transcript
Alex Coles | RubyConf Portugal, Braga Frontend Choices
olá Braga
not really about choice
I’m a backend guy living in a frontend world “
quem sou eu?
@myabc Alex Coles Berlin, Germany Finn GmbH
@myabc openproject.org openproject.org OpenProject
@myabc eurucamp.org eurucamp.org eurucamp
@myabc eurucamp.org eurucamp.org eurucamp
10 years ago
10 years ago 2004
10 years ago what was I doing?
10 years ago what was I doing?
10 years ago what was I doing?
10 years ago what was the world doing?
10 years ago what was the world doing?
10 years ago what was the world doing?
10 years ago what was the world doing?
10 years ago what was the world doing?
10 years ago what was Portugal doing?
10 years ago what was Portugal doing?
10 years ago what was Portugal doing?
10 years ago what were you doing?
10 years ago what were you doing? ?
10 years ago what was Apple doing?
10 years ago what was Apple doing?
10 years ago what was Apple doing?
10 years ago what was the web doing?
10 years ago what was the web doing?
10 years ago there was no jQuery!
10 years ago but the end of 2004 was to
mark a transition
None
None
The Rails Way
Rails is so 2005 “
Rails is so 2005 “
“Rails Way” back in 2005
“Rails Way” back in 2005 •Server Generated HTML (ERB, etc.)
“Rails Way” back in 2005 •Server Generated HTML (ERB, etc.)
•Prototype
“Rails Way” back in 2005 •Server Generated HTML (ERB, etc.)
•Prototype •Scriptaculous
“Rails Way” back in 2005 •Server Generated HTML (ERB, etc.)
•Prototype •Scriptaculous •RJS
http://slash7.com/assets/2006/10/8/RJS-Demistified_Amy-Hoy-slash7_1.pdf RJS
http://slash7.com/assets/2006/10/8/RJS-Demistified_Amy-Hoy-slash7_1.pdf RJS
RJS
RJS <div id="items"></div> <%= link_to_remote 'Add to cart', url:
{ controller: 'cart', action: 'add_to_cart' }%> erb view
RJS <div id="items"></div> <%= link_to_remote 'Add to cart', url:
{ controller: 'cart', action: 'add_to_cart' }%> erb view class CartController < ActionController::Base def add_to_cart @item = CartItem.new @cart.items << @item end end controller
RJS <div id="items"></div> <%= link_to_remote 'Add to cart', url:
{ controller: 'cart', action: 'add_to_cart' }%> erb view class CartController < ActionController::Base def add_to_cart @item = CartItem.new @cart.items << @item end end controller page.insert_html :bottom, :items, partial: 'item', object: @item page.replace_html :items_count, I18n.t(:item, count: @cart.items.count) rjs view
…we mostly had “websites”
yahoo.com Yahoo! 2004
bindows.net Bindows 2004
gmail.com Gmail pre-β 2002-4 http://techcrunch.com/2008/06/06/the-evolution-of-pre-launch-gmail-in-screenshots/
where we are now
…we have “applications”
soundcloud.com Soundcloud
Single Page Application Architecture
Single Page Application Architecture - +
chunking Single Page Application Architecture - +
chunking controller Single Page Application Architecture - +
chunking controller templating Single Page Application Architecture - +
chunking controller templating routing Single Page Application Architecture - +
chunking controller templating routing real-time communicaton Single Page Application Architecture
- +
chunking controller templating routing real-time communicaton local storage Single Page
Application Architecture - +
“Rails Way” now
“Rails Way” now • Server Generated HTML (ERB, Slim, HAML
etc.)
“Rails Way” now • Server Generated HTML (ERB, Slim, HAML
etc.) • jQuery
“Rails Way” now • Server Generated HTML (ERB, Slim, HAML
etc.) • jQuery • jQuery UI
“Rails Way” now • Server Generated HTML (ERB, Slim, HAML
etc.) • jQuery • jQuery UI • Server generated JavaScript Responses (SJR)
JavaScript has grown up
JavaScript has grown up percentage of total JS developer jobs
has doubled from 2005 to 2010 indeed.com
JavaScript has grown up Server-side usage of JS has been
multiplied by 6 from Jan 2012 to Oct 2014 W3Techs.com
no backend nobackend.org
hood.ie Hoodie
isomorphism
meteor.com Meteor
frontend frameworks
frontend (MV*) frameworks
frontend (MV*) frameworks AngularJS
frontend (MV*) frameworks AngularJS KnockoutJS
frontend (MV*) frameworks AngularJS Ember.js KnockoutJS
frontend (component) frameworks
frontend (component) frameworks Ractive.js
ReactJS frontend (component) frameworks Ractive.js
ReactJS Backbone View (alone) frontend (component) frameworks Ractive.js
ReactJS ExtJS Backbone View (alone) frontend (component) frameworks Ractive.js
TodoMVC todomvc.com
More on MV*…
None
None
None
but I <3 Ruby !
so here is the question
“
is there room for Rails?
“ – Marcin Stecki @madsheepPL at wroc_love.rb Not his [DHH’s]
responsibility to tell us how to do these things.
single page vs. traditional HTML
naturally content-dependent
what is your content? general personal
what is your content? Information pages general personal
what is your content? Information pages Membership sites general personal
what is your content? Information pages Closed systems Membership sites
general personal
content criteria
content criteria • authentication
content criteria • authentication • how real is real-time
content criteria • authentication • how real is real-time •
caching
content criteria • authentication • how real is real-time •
caching • indexing (SEO)
how unique is the view to be rendered?
how unique is the view to be rendered? how many
combinations of a unique set of data?
how unique is the view to be rendered? how many
combinations of a unique set of data? • a blog with comments
how unique is the view to be rendered? how many
combinations of a unique set of data? • a blog with comments • a hotel page with reviews
how unique is the view to be rendered? how many
combinations of a unique set of data? • a blog with comments • a hotel page with reviews • a dashboard
if it is curated content Rails way →
other ways are better if it is SPA →
some tips
what is most like Rails? tip 1: familiarity
what is most like Rails? tip 1: familiarity
tip 1: familiarity Ember.js is most like Rails
Ember.js is most like Rails
Ember.js is most like Rails • everything should inherit from
main object
Ember.js is most like Rails • everything should inherit from
main object ActiveRecord::Base.inherited)
Ember.js is most like Rails • everything should inherit from
main object ActiveRecord::Base.inherited) Ember.Object
Ember.js is most like Rails • everything should inherit from
main object ActiveRecord::Base.inherited) Ember.Object Plain Old JavaScript Objects
Ember.js is most like Rails
Ember.js is most like Rails • routing DSL
Ember.js is most like Rails • routing DSL built-in routing
Ember.js is most like Rails • routing DSL built-in routing
built-in routing
Ember.js is most like Rails • routing DSL built-in routing
not in core, third party solutions built-in routing
Ember.js is most like Rails
Ember.js is most like Rails • vocabulary (templates, partials, etc.)
Ember.js is most like Rails • vocabulary (templates, partials, etc.)
Models, Controllers, Views, Initializers
Ember.js is most like Rails • vocabulary (templates, partials, etc.)
Models, Controllers, Views, Initializers Models, Controllers, Views, Initializers
Ember.js is most like Rails • vocabulary (templates, partials, etc.)
Dependency Injection, Factories, Services, Providers, Transclusion Models, Controllers, Views, Initializers Models, Controllers, Views, Initializers
how to make things work with Rails?
using asset pipeline / sprockets tip 2: Rails “the non-Rails
way
use Bower
use Bower
3 options for using Bower
gem install bower-rails 1 option gem
config.assets.paths << File.join(Rails.root, 'vendor', 'assets', ‘components') Rails 4 (Sprockets 2+)
2 option
rails-assets.org rails-assets.org 3 option
ember-rails-api github.com/dockyard/ember-appkit-rails
the app/assets/javascripts silo
one more thing… (sidetrack)
voltframework.com Volt Framework Volt is a framework for building data
rich web applications shockingly fast. Play Video ! Get Started " Home Getting Started Docs API Blog Community #
what is the way forward? →
(IMHO)
split completely ! tip 3: split
I don’t like monoliths
applications 2
applications 2 =
applications 2 = 1 API +
applications 2 frontend = 1 API + 1
API
API Rails
API Rails Sinatra
API Rails Sinatra Lotus.rb
frontend API Rails Sinatra Lotus.rb
frontend API Rails Sinatra JS workflows Lotus.rb
JavaScript tooling
isomorphism is possible http://nerds.airbnb.com/isomorphic-javascript-future-web-apps/
surprisingly well testable (and fast)
muito obrigado!
perguntas?
@myabc