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
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
110k
全社でのソフトウェアサプライチェーン攻撃対策をやってみた with Takumi Guard
z63d
0
270
VPCセキュリティ対応の最新事情
nagisa53
1
240
SoccerMaster: A Vision Foundation Model for Soccer Understanding
kzykmyzw
0
160
AmplifyHostingConstructからSSRフレームワークのためのホスティング設計を考察する/amplify-hosting-construct
fossamagna
1
300
凡エンジニアがこの先生きのこるためには。〜TypeScript完全に理解したい〜
alchemy1115
2
410
AI時代のPlaywright活用(システムテストを自動化する ー 実行エンジンにPla ywrightを選んだ理由)
ynisqa1988
2
930
41歳でAWSが好きすぎてITエンジニアになったおっさんの話
yama3133
1
730
キャリアLT会#3
beli68
2
230
Webアプリ認証の全体像 / The Big Picture of Web App Authentication
kitano_yuichi
1
410
現場との対話から始める “作る前に問い直す”業務改善
mochico50
1
210
データエンジニアリングとドメイン駆動設計
masuda220
PRO
14
2.5k
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
9
900
Accessibility Awareness
sabderemane
1
160
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
200
WCS-LA-2024
lcolladotor
0
750
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
550
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
40k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
180
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
610
Are puppies a ranking factor?
jonoalderson
1
3.7k
Code Reviewing Like a Champion
maltzj
528
40k
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