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
Why you should use a MV* framework
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Joël Cox
April 19, 2013
Programming
2
620
Why you should use a MV* framework
Presented at Codee (
http://cod.ee
.)
More from me about
business and technology
.
Joël Cox
April 19, 2013
Tweet
Share
More Decks by Joël Cox
See All by Joël Cox
Pixelpillow College Tour - HTTP APIs
joelcox
0
18
Pixelpillow College Tour - Call me Maybe
joelcox
0
31
Pixelpillow College Tour - Grafen, automaten en reguliere talen
joelcox
0
64
CI Joe
joelcox
0
74
Shipping products in a start-up environment
joelcox
0
63
Measuring Dependency Freshness in Software Systems
joelcox
0
110
(Really) naive data mining
joelcox
2
630
Deploying large scale web applications
joelcox
1
270
Other Decks in Programming
See All in Programming
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
2.5k
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.6k
Data-Centric Kaggle
isax1015
2
780
2026年 エンジニアリング自己学習法
yumechi
0
140
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
1
110
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
610
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
MUSUBIXとは
nahisaho
0
140
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
470
Architectural Extensions
denyspoltorak
0
290
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
5
760
Featured
See All Featured
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
380
GraphQLとの向き合い方2022年版
quramy
50
14k
The Curse of the Amulet
leimatthew05
1
8.7k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
730
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Facilitating Awesome Meetings
lara
57
6.8k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Navigating Weather and Climate Data
rabernat
0
110
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
140
Being A Developer After 40
akosma
91
590k
Designing for Timeless Needs
cassininazir
0
130
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
77
Transcript
WHY YOU SHOULD USE A CLIENT-SIDE MV FRAMEWORK Joël Cox
joelcox.nl @joelcox ˒
Who is this kid? (And why should I listen to
him?)
None
- Where are we coming from? - What are the
challenges? - Where are we heading?
VERY LITTLE CODE AHEAD WARNING:
Once upon a time, a team at a small so
ware company in Redmond, USA set out to make the web a bit more dynamic...
XMLHttpRequest
XMLHttpRequest be er known as AJAX
Other browsers adopted the new “standard”and we lived happily ever
a er.
Other browsers adopted the new “standard”and we lived happily ever
a er?
How many people here consider themselves to be experienced jQuery
programmers?
How many people here consider themselves to be experienced JavaScript
programmers?
$.post('api/endpoint', {key: value}, { success: function(data) { $('#container').appendTo(data.message); $.get('api/endpoint/' +
data.id, function(data) { $.get('api/endpoint/2', function(data) { // More callbacks }); }), }, error: function(errorMessage) { $('#container').appendTo(errorMessage); // More callbacks, again. }); } });
Somehow jQuery made us forget about good practices (callbacks ain’t
bad, but not 5 levels deep)
And now you want to make rich, desktop-like, web applications
and then shit hits the fan
Didn’t we see that before?
<html> <head> <title>Articles</title> <?php if (isset($_COOKIE['auth'])) header('/login'); $article = $db->get_results('SELECT
* FROM pages WHERE id = "' . mysql_string_escape($_GET['id'] . '"'); ?> </head> <body> <?php foreach ($articles as $article): ?> <h1><?= $article->title ?></h1> <em>By <?= $article->author ?></em> <?= format_body($article->content) ?> <?php endforeach ?> </body> </html>
MVC
Model (data) Controller (request) View (layout)
Traditional web MVC does all this work on the server
Client-side MV frameworks put all this functionality in the browser
˒
Model (data) Controller (request) View (UI) Template (layout)
˒ ?
- Where are we coming from? - What are the
challenges? - Where are we heading?
None
Lesson #1 Brush up your JS skills, big time
Why is function suddenly undefined for this?
... Server.prototype.bindListeners = function() { this.socket.on('data', this.processData); }; Server.prototype.doSomething =
function(part) { ... }; Server.prototype.processData = function(data) { this.doSomething(data); }; > TypeError: Object #<Object> has no method 'doSomething'
... Server.prototype.bindListeners = function() { this.socket.on('data', this.processData); }; Server.prototype.doSomething =
function(part) { ... }; Server.prototype.processData = function(data) { this.doSomething(data); }; > TypeError: Object #<Object> has no method 'doSomething' this refers to socket, not Server
... Server.prototype.bindListeners = function() { this.socket.on('data', this.processData.bind(this)); }; Server.prototype.doSomething =
function(part) { ... }; Server.prototype.processData = function(data) { this.doSomething(data); }; > TypeError: Object #<Object> has no method 'doSomething'
“Learning JavaScript with Object Graphs” on How To Node “Understanding
bind and bindAll [in Backbone.js]” on Big Binary
Lesson #2 Todo apps don’t give you the whole story
Nested views; how do the different frameworks handle this ?
(Hints: Zombie views and rerender all the things!)
Lesson #3 Flexibility is killer
Use something like Marione e.js for additional structure
Lesson #4 Listen to the experts (Derek Bailey, Addy Osmani,
Tom Dale)
“The best programmers are the quickest to Google” – Vu
Tran
Lesson #5 Refactor, refactor, refactor.
Not tackeling stuff right now will leave you with huge
technical debt
- Where are we coming from? - What are the
challenges? - Where are we heading?
Shared codebase between client and server (h ps://github.com/airbnb/rendr)
API Driven Development (h p://alexbilbie.com/2013/03/api-driven-development-talk/)
Fin. Thanks for listening!