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
170
SDL as an Artifact: Code-First Schemas and GraphQL Nexus
tgriesser
0
220
End-to-End Testing for the Modern Web
tgriesser
0
180
Paving a New Path for GraphQL Schemas
tgriesser
0
110
Embracing the Power of GraphQL
tgriesser
2
1.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
210
Other Decks in Technology
See All in Technology
変更し続けられるシステムをどう保つか — AI時代のSSoTという設計原則
kawauso
1
1.4k
信頼できるテスティングAIをどう育てるか?
odan611
0
120
Jitera Company Deck
jitera
0
620
AI Native なプロダクト組織の立ち上げ方 : 生産性 100 倍への挑戦
mikesorae
0
1.6k
PHPで作って学ぶリアルタイム音声対話AIとWebSocket入門 by ムナカタ
munakata
0
170
QA・ソフトウェアテスト研修【MIXI 26新卒技術研修】
mixi_engineers
PRO
3
1.3k
なぜ、あなたのエージェントは言うことを聞かないのか
segavvy
1
540
コンポーネント名には何を含めるべきなのか? / what-should-be-included-in-component-names
airrnot1106
0
140
カメラ×AIで挑む「ホワイト物流」― 車両管理、自動化の壁と突破口【SORACOM Discovery 2026】
soracom
PRO
0
140
モバイル研修【MIXI 26新卒技術研修】
mixi_engineers
PRO
1
260
基調講演:人とAIをつなぐIoTの今と未来 ー 「フィジカル」と「デジタル」が出会うその先へ【SORACOM Discovery 2026】
soracom
PRO
0
290
【公開用】AI_Dev_Ex2026_AI_登壇資料
matsuritechnologies
PRO
2
680
Featured
See All Featured
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
360
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.7k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.5k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
520
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Automating Front-end Workflow
addyosmani
1370
210k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
67
56k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
470
First, design no harm
axbom
PRO
2
1.2k
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