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
640
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
More Decks by Joël Cox
See All by Joël Cox
Pixelpillow College Tour - HTTP APIs
joelcox
0
25
Pixelpillow College Tour - Call me Maybe
joelcox
0
36
Pixelpillow College Tour - Grafen, automaten en reguliere talen
joelcox
0
67
CI Joe
joelcox
0
76
Shipping products in a start-up environment
joelcox
0
69
Measuring Dependency Freshness in Software Systems
joelcox
0
120
(Really) naive data mining
joelcox
2
660
Deploying large scale web applications
joelcox
1
270
Other Decks in Programming
See All in Programming
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.5k
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
490
Loosening the Reins: Go Generics Get More Flexible
kuro_kurorrr
0
310
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
280
VibeCodingからAgenticWorkflowへ
starfish719
0
840
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
240
リアルな遅延を測る仕様
kota_yata
1
130
typoなんかねぇよ
raspython3
0
530
源内ハンズオン概要編
hideg
0
210
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1k
170k Jobs a Day on GKE: Scaling Mercari's CI Platform - and What's Next for AI-Native Development
junyaokabe
0
120
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
210
Featured
See All Featured
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
250
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
280
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
4 Signs Your Business is Dying
shpigford
187
23k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
690
Marketing to machines
jonoalderson
1
5.7k
The Spectacular Lies of Maps
axbom
PRO
1
940
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
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!