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
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
17
Pixelpillow College Tour - Call me Maybe
joelcox
0
28
Pixelpillow College Tour - Grafen, automaten en reguliere talen
joelcox
0
63
CI Joe
joelcox
0
69
Shipping products in a start-up environment
joelcox
0
60
Measuring Dependency Freshness in Software Systems
joelcox
0
110
(Really) naive data mining
joelcox
2
610
Deploying large scale web applications
joelcox
1
260
Other Decks in Programming
See All in Programming
テストコードはもう書かない:JetBrains AI Assistantに委ねる非同期処理のテスト自動設計・生成
makun
0
200
TDD 実践ミニトーク
contour_gara
1
290
Ruby Parser progress report 2025
yui_knk
1
410
Flutter with Dart MCP: All You Need - 박제창 2025 I/O Extended Busan
itsmedreamwalker
0
140
AIコーディングAgentとの向き合い方
eycjur
0
260
アプリの "かわいい" を支えるアニメーションツールRiveについて
uetyo
0
210
Navigating Dependency Injection with Metro
zacsweers
2
190
Rancher と Terraform
fufuhu
2
240
@Environment(\.keyPath)那么好我不允许你们不知道! / atEnvironment keyPath is so good and you should know it!
lovee
0
110
AIと私たちの学習の変化を考える - Claude Codeの学習モードを例に
azukiazusa1
7
3.2k
ソフトウェアテスト徹底指南書の紹介
goyoki
1
150
基礎から学ぶ大画面対応(Learning Large-Screen Support from the Ground Up)
tomoya0x00
0
370
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
131
19k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Thoughts on Productivity
jonyablonski
70
4.8k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
111
20k
The Language of Interfaces
destraynor
161
25k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.5k
Why Our Code Smells
bkeepers
PRO
339
57k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
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!