Slide 1

Slide 1 text

Transferring application data efficiently with Transit by Filip Zrůst (@frzng)

Slide 2

Slide 2 text

http://www.thoughtworks.com/insights/blog/happy-10th-birthday-selenium Selenium 10 YO Happy birthday!

Slide 3

Slide 3 text

PragueJS 2014.10 Transit a format and set of libraries for conveying values between applications

Slide 4

Slide 4 text

Context • Cognitect • Rich Hickey • Clojure, Ruby, browser https://twitter.com/bodil/status/522479098783072256

Slide 5

Slide 5 text

Context - Marshaling arbitrary types - Exchange between languages - Verbosity of popular formats
 - JSON everywhere - Well-known - Fast parsers

Slide 6

Slide 6 text

What • Data exchange format • Languages agnostic • No schema • Extensible • Efficient

Slide 7

Slide 7 text

But JSON…

Slide 8

Slide 8 text

Why • Limited types • Verbosity • Top-level elements

Slide 9

Slide 9 text

How • Plain old JSON when possible • Encoding not enclosing • Caching repeated values • Open type extensibility • Any element can be top-level

Slide 10

Slide 10 text

How • Plain old JSON when possible • Encoding not enclosing • Caching repeated values • Open type extensibility • Any element can be top-level

Slide 11

Slide 11 text

How • Plain old JSON when possible • Encoding not enclosing • Caching repeated values • Open type extensibility • Any element can be top-level { "name": "PragueJS 2014.10", "speakers": [ "@steida", "@abtris", "@frzng" ] } JSON { "name": "PragueJS 2014.10", "speakers": [ "@steida", "@abtris", "@frzng" ] } Transit

Slide 12

Slide 12 text

How • Plain old JSON when possible • Encoding not enclosing • Caching repeated values • Open type extensibility • Any element can be top-level

Slide 13

Slide 13 text

How • Plain old JSON when possible • Encoding not enclosing • Caching repeated values • Open type extensibility • Any element can be top-level { "name": "PragueJS 2014.10", "speakers": [ "@steida", "@abtris", "@frzng" ], "start": { "type": "DateTime", "value": "2014-10-23T18:00:00+02:00" } } JSON { "name": "PragueJS 2014.10", "speakers": [ "@steida", "@abtris", "@frzng" ], "start": "~t2014-10-23T18:00:00+02:00" } Transit

Slide 14

Slide 14 text

How • Plain old JSON when possible • Encoding not enclosing • Caching repeated values • Open type extensibility • Any element can be top-level

Slide 15

Slide 15 text

How • Plain old JSON when possible • Encoding not enclosing • Caching repeated values • Open type extensibility • Any element can be top-level { "name": "PragueJS 2014.10", "speakers": [ { "handle": "@steida" }, { "handle": "@abtris" }, { "handle": "@frzng" } ], "start": { "type": "DateTime", "value": "2014-10-23T18:00:00+02:00" } } JSON Transit { "name": "PragueJS 2014.10", "speakers": [ [ "^ ", "handle", "@steida" ], [ "^ ", "^2", "@abtris" ], [ "^ ", "^2", "@frzng" ] ], "start": "~t2014-10-23T18:00:00+02:00" } Transit [ "^ ", "name", "PragueJS 2014.10", "speakers", [ [ "^ ", "handle", "@steida" ], [ "^ ", "^2", "@abtris" ], [ "^ ", "^2", "@frzng" ] ], "start", "~t2014-10-23T18:00:00+02:00" ] Transit

Slide 16

Slide 16 text

How • Plain old JSON when possible • Encoding not enclosing • Caching repeated values • Open type extensibility • Any element can be top-level

Slide 17

Slide 17 text

How • Plain old JSON when possible • Encoding not enclosing • Caching repeated values • Open type extensibility • Any element can be top-level

Slide 18

Slide 18 text

Types JSON • string • number • object • array • boolean • null Transit Types • string • integer • map • array • boolean • null • bytes
 • double • keyword • symbol • decimal • bigint • timestamp • date/time • UUID • URI • char • quoted • special number • scalar extension
 • set • list • cmap • link • composite extension

Slide 19

Slide 19 text

Price • You write readers and writers • Human readability is not a goal

Slide 20

Slide 20 text

Example

Slide 21

Slide 21 text

Summary • Arbitrary types between apps and languages • Self-describing, no schema • JSON or MessagePack • Set of libraries ready to use • Send infinity over the wire

Slide 22

Slide 22 text

Resources • Cognitect - Transit (format specification):
 https://github.com/cognitect/transit-format • Rich Hickey - Transit (announcement):
 http://blog.cognitect.com/blog/2014/7/22/transit • Russ Olsen - Bridging Language Barriers with Transit (webinar):
 http://www.cognitect.com/events/webinars

Slide 23

Slide 23 text

Thank you and something about me… Filip Zrůst @frzng Freelancing naysayer FP enthusiast Idealist