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
Data Based JavaScript
Search
Tim Griesser
December 15, 2014
Technology
270
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Data Based JavaScript
Tim Griesser
December 15, 2014
More Decks by Tim Griesser
See All by Tim Griesser
SDL as an Artifact: Code-First Schemas in TS & JS
tgriesser
0
160
SDL as an Artifact: Code-First Schemas and GraphQL Nexus
tgriesser
0
210
End-to-End Testing for the Modern Web
tgriesser
0
170
Paving a New Path for GraphQL Schemas
tgriesser
0
110
Embracing the Power of GraphQL
tgriesser
2
1k
Redux: A Predictable State Container for JavaScript Apps
tgriesser
2
450
Making Relational Cool Again (or: JavaScript on ACID)
tgriesser
1
440
The Future is Now: JavaScript, ES6, and Babel JS
tgriesser
7
1.3k
Nodevember - Making Relational Cool Again
tgriesser
1
200
Other Decks in Technology
See All in Technology
コードレビューを制するチームがソフトウェアデリバリーのフローを制す / Beyond Code Review: Distributing Its Responsibilities Across the SDLC
mtx2s
4
1.3k
実装は速くなった、レビューはどうする? ― 自身のレビューをAIで再現させるサーヴァントエンジニアリングのすゝめ / Implementation got faster. So what about reviews? — An invitation to Servant Engineering: Recreating your own code reviews with AI
nrslib
7
4.2k
AWSシリコン最前線 〜AI時代のチップ選択を読み解く〜
htokoyo
1
190
社内 AI エージェント Synapse と セマンティックレイヤーの育て方
hiroakis
0
260
Platform Engineering as a Product: Criteria for Improvement and Multi-Tenant Design
kumorn5s
0
520
AI駆動開発が変える、大規模開発の前提 ーHuman in the Loop から Human on the Loop へ / AIE2026
visional_engineering_and_design
27
16k
個人最適 から 全体最適 へ AI情報共有会・AIギルド・AI-DLC で進める カンリーの組織展開
rfdnxbro
0
1.8k
noUncheckedIndexedAccess、3時間、1万円。 / noUncheckedIndexedAccess, 3 Hours, 10,000 JPY.
kaonavi
1
330
速さだけじゃない! VoidZero ツールが移行先に選ばれる理由
mizdra
PRO
6
770
Microsoft Build Keynoteふりかえり
tomokusaba
0
100
Claude Code×Terraform IaC テンプレート駆動開発
itouhi
1
430
10倍の生産性を実現するAI駆動並列エージェントのすべて
kumaiu
4
900
Featured
See All Featured
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
290
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
How to make the Groovebox
asonas
2
2.2k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
1
160
Unsuck your backbone
ammeep
672
58k
Amusing Abliteration
ianozsvald
1
200
Transcript
Data Based JavaScript
DataBase JavaScript?
None
Heavily Inspired by Backbone.js ! • Documentation • API •
Philosophy • Conventions
None
None
None
The Big Idea??
JavaScript “Holy Grail”
None
None
None
JavaScript “Holy Grail”
None
…but I’ve given talks on this before
…and there’s still a lot of work to be done
Data Based JavaScript
Backbone Models & Collections
None
Some Thoughts, Opinions
Some Thoughts, Opinions Backbone Models & Collections do too much
Some Thoughts, Opinions Backbone Models & Collections do too much
Backbone Models & Collections alone aren’t enough
Some Thoughts, Opinions Backbone Models & Collections do too much
Backbone Models & Collections alone aren’t enough There’s better ways than listening to individual change events
Some Thoughts, Opinions Backbone Models & Collections do too much
Backbone Models & Collections alone aren’t enough There’s better ways than listening to individual change events
Backbone Models & Collections do too much
Backbone Models & Collections (might) do too much
Backbone Models & Collections (might) do too much Wrapping Data
(attributes, get, set) Validations Change Notification Relations??? Syncing?? App Specific Logic Models
Backbone Models & Collections (might) do too much Wrapping Data
(attributes, get, set) Validations Change Notification Relations??? Syncing?? App Specific Logic Wrapping models Adding, removing, fetching models Tight ties with model (change / url) Maybe pagination??? Maybe nested models?? Maybe…whatever else you want to put there? Models Collections
What should they do Wrapping Data (attributes, get, set) Return
external relations based on attributes Limited Change Notification App Specific Logic Filter models Models Collections
Collections
None
.length .pop .push .shift .unshift .slice Array-like API
None
None
Behave like sorted maps
Behave like sorted maps which gets a little tricky…
{ add: true remove: false merge: true } Collection#set
Backbone.Model and Backbone.Collection might not be enough
Backbone.Model and Backbone.Collection might not be enough Multiple “sources of
truth”
Backbone.Model and Backbone.Collection might not be enough Multiple “sources of
truth” Object Identity issues
Backbone.Model and Backbone.Collection might not be enough Multiple “sources of
truth” Object Identity issues No definitive place of knowing what data exists in your application
Better than change events?
What might an elegant solution look like?
Limit scope of Models & Collections
Complexities of Models & Collections
Simplify of listening to change / time
Backbone.Session
Backbone.Session Think like a session cookie
Backbone.Session Think like a session cookie Similar to Backbone.sync
Backbone.Session Think like a session cookie Similar to Backbone.sync Models
& collections reference back to session
getPath()
getPath()
None
None
Relations
model.set('first_name', 'Tim')
model.set('first_name', 'Tim') model.session.setIn(['users', 1, 'first_name'], 'Tim')
model.set('first_name', 'Tim') model.session.setIn(['users', 1, 'first_name'], 'Tim') refresh views containing models
looking at paths ['users'], ['users', 1]
model.set('first_name', 'Tim') model.session.setIn(['users', 1, 'first_name'], 'Tim') refresh views containing models
looking at paths ['users'], ['users', 1] Socket, Ajax, etc.
What does this gain us? Drastically simplifies Collections Single source
of truth for everything data related Easy to switch into offline mode
None
None
None
Beyond Backbone Models & Collections
None
var x = new Immutable.Map({a: 1}); ! var y =
x.set('b', 2); ! x.get('a') // 1 ! y.get('a') // 1 ! x.get('b') // undefined ! y.get('b') // 2
Takeaway Points If you like Node but want RDBMS check
out Knex & Bookshelf
Takeaway Points If you like Node but want RDBMS check
out Knex & Bookshelf Maybe Backbone.Session could be a thing?
Takeaway Points If you like Node but want RDBMS check
out Knex & Bookshelf Maybe Backbone.Session could be a thing? Or maybe &.Session?
Summary Time spent critically analyzing the data flow in your
application can save a lot of time later