Slide 1

Slide 1 text

Introducing Dan Gebhardt @dgeb Boston Ember January 2014

Slide 2

Slide 2 text

A STORY THAT BEGINS AND ENDS WITH EMBER

Slide 3

Slide 3 text

2+ YEARS AGO

Slide 4

Slide 4 text

1.5 YEARS AGO

Slide 5

Slide 5 text

11 MONTHS AGO

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

JANUARY 2014

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

WHAT'S NEXT FOR AMBITIOUS WEB APPLICATIONS?

Slide 10

Slide 10 text

ASYNCHRONOUS UI

Slide 11

Slide 11 text

OFFLINE SUPPORT

Slide 12

Slide 12 text

DATA SYNCHRONIZATION

Slide 13

Slide 13 text

EDITING CONTEXTS

Slide 14

Slide 14 text

UNDO / REDO

Slide 15

Slide 15 text

NEW CHALLENGES FOR DATA

Slide 16

Slide 16 text

DATA CHANGES OVER TIME

Slide 17

Slide 17 text

SAME DATA - MANY PLACES

Slide 18

Slide 18 text

SAME DATA - MANY STATES

Slide 19

Slide 19 text

SOURCE OF TRUTH ?

Slide 20

Slide 20 text

AD HOC CONNECTIONS

Slide 21

Slide 21 text

TEMPORARY CONNECTIONS

Slide 22

Slide 22 text

BLOCKING OPERATIONS

Slide 23

Slide 23 text

NON-BLOCKING CONNECTIONS

Slide 24

Slide 24 text

CONFLICT RESOLUTION

Slide 25

Slide 25 text

PRIMITIVE SOLUTIONS

Slide 26

Slide 26 text

COMMON INTERFACES

Slide 27

Slide 27 text

DATA NORMALIZATION

Slide 28

Slide 28 text

TRANSFORMATIONS

Slide 29

Slide 29 text

EVENTS

Slide 30

Slide 30 text

PROMISES

Slide 31

Slide 31 text

BLOCKING TRANSFORMATIONS

Slide 32

Slide 32 text

NON-BLOCKING TRANSFORMATIONS

Slide 33

Slide 33 text

JUNE 2013

Slide 34

Slide 34 text

7 MONTHS LATER ...

Slide 35

Slide 35 text

A standalone library for coordinating access to data sources and keeping their contents synchronized.

Slide 36

Slide 36 text

• Plain JavaScript • No dependencies (excepts a Promises/A+ library like RSVP) • Supports access to and transformation of any number of data sources... as long as they support the right interfaces. • Supports synchronous and asynchronous operations • Supports blocking and non-blocking operations

Slide 37

Slide 37 text

COMMON INTERFACES

Slide 38

Slide 38 text

• Requestable - for accessing and modifying data • Methods: find, add, update, patch, remove, link, unlink • Transformable - for transforming data • Methods: transform COMMON INTERFACES

Slide 39

Slide 39 text

• MemorySource - an in-memory store • LocalStorageSource - an in-memory store that also persists to local storage • JSONAPISource - for JSON-API-compliant REST requests CORE SOURCES

Slide 40

Slide 40 text

TRANSFORMATIONS

Slide 41

Slide 41 text

{"op":"remove","path":["planet","1389295329110.3"]} {"op":"add","path":["planet","1389295895882.1"],"value": {"name":"Mercury","id":"1389295895882.1"}} {"op":"remove","path":["planet","1389295895882.1"]} {"op":"add","path":["planet","1389296188090.2"],"value": {"name":"Mercury","id":"1389296188090.2"}} {"op":"add","path":["planet","1389296196274.3"],"value": {"name":"Venus","id":"1389296196274.3"}} {"op":"add","path":["planet","1389296197897.4"],"value": {"name":"Earth","id":"1389296197897.4"}} {"op":"add","path":["planet","1389296199041.5"],"value": {"name":"Mars","id":"1389296199041.5"}} TRANSFORMATIONS Transformations follow RFC 6902 (JSON Patch):

Slide 42

Slide 42 text

• Document is a complete implementation of RFC 6902 • Transformation methods: transform, add, remove, replace, move, copy and test. • Retrieval methods: retrieve TRANSFORMATIONS

Slide 43

Slide 43 text

EVENTS

Slide 44

Slide 44 text

• Notifiers can emit messages to an array of subscribed listeners. • Evented interface can emit events and listen for responses. • Promises returned as responses can be resolved (first to resolve) or settled (once all resolved or failed). EVENTS

Slide 45

Slide 45 text

BLOCKING TRANSFORMATIONS

Slide 46

Slide 46 text

NON-BLOCKING TRANSFORMATIONS

Slide 47

Slide 47 text

• TransformConnector for connecting a source and target. • Two connectors are needed for bi-directional syncs. • Connectors can be blocking or not • RequestConnector for coordinating requests to data CONNECTORS

Slide 48

Slide 48 text

DEMO TIME!

Slide 49

Slide 49 text

+ ?

Slide 50

Slide 50 text

• Ember Data Orbit Adapter • Keep Orbit in the adapter layer • Works ok, but doesn't allow for bi-directional syncs INTEGRATION OPTIONS

Slide 51

Slide 51 text

• Ember Data Support for Orbit Interfaces • Would provide the benefits of Orbit to Ember Data users • Would involve some breaking changes • Require use of Orbit-compliant adapters INTEGRATION OPTIONS

Slide 52

Slide 52 text

• Ember/Orbit Integration without Ember Data • Would allow for the most flexibility in implementation • Would add one more option to a crowded field INTEGRATION OPTIONS

Slide 53

Slide 53 text

SOURCES • Igor Terzic's Ember Data talk: http://www.infoq.com/presentations/ember-data • Alex Maccaw's post on Asynchronous UIs: http://blog.alexmaccaw.com/asynchronous-ui • Differential synchronization by Neil Fraser: https://neil.fraser.name/writing/sync/ • Promises A+ http://promises-aplus.github.io/promises-spec/

Slide 54

Slide 54 text

AND FINALLY... • Orbit.js: https://github.com/cerebris/orbit.js • Orbit / Ember example: https://github.com/dgeb/orbit-ember-example • Slides: https://speakerdeck.com/dgeb

Slide 55

Slide 55 text

Boston Ember January 2014 THANKS! @dgeb