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
91
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
320
Putting the Hype back in Hypermedia
myabc
1
250
DataMapper
myabc
2
240
Other Decks in Technology
See All in Technology
【CEDEC2026】Creative Approaches to Localizing the Dialects and Unique Speech of Umamusume: Pretty Derby Characters in English
cygames
PRO
3
22k
Bits AI を制するものは Datadog を制す / The player that controls Bits AI, controls Datadog
kaminashi
0
100
Invisible to AI? Making TYPO3 Sites Quotable by AI Search Systems
wolfgangwagner
0
200
PLATEAU で バーチャル花火大会
tatsuya1970
0
160
攻撃と防御で学ぶAI時代のプロダクトセキュリティ演習
recruitengineers
PRO
9
2.8k
修正PRを食べてレビュースキルが賢くなる:Claude Codeによる自己改善サイクル
yuyaumetsu
6
1.5k
メルカリのグローバルアプリで挑んだ AlloyDB 運用と課題解決の実践記
hatappi
0
250
Breaking the Seal: Static Deobfuscation of Compiled V8 JavaScript Bytecode Malware
hshrzd
0
770
Software Supply Chain Attackからクラウド環境を守るためにできること
lhazy
2
260
社内の7割が使うデータ基盤を、 データチーム2人で回すためにやったこと
koh_yoshi
4
1.4k
【CEDEC2026】『GRANBLUE FANTASY: Relink - Endless Ragnarok』のバトル制作事例 ~最高のキャラゲーを目指して~
cygames
PRO
0
300
【CEDEC2026】『ウマ娘 プリティーダービー』 英語版のキャラクターの方言や口調をローカライズするための創造的アプローチ
cygames
PRO
2
960
Featured
See All Featured
The Curse of the Amulet
leimatthew05
2
14k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
A better future with KSS
kneath
240
18k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
240
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
45k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
We Are The Robots
honzajavorek
0
300
How STYLIGHT went responsive
nonsquared
100
6.2k
Building Adaptive Systems
keathley
44
3.2k
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