Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Transferring application data efficiently with ...

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Transferring application data efficiently with Transit

The new format and libraries on top of JSON with extensible types and caching. There is a repository with example code at GitHub (https://github.com/frzng/attendees.js).

References & resources:
- Paul Hammant - Happy 10th Birthday, Selenium: http://www.thoughtworks.com/insights/blog/happy-10th-birthday-selenium
- Rich Hickey - Simple Made Easy (meaning of a word decomplecting): http://www.infoq.com/presentations/Simple-Made-Easy-QCon-London-2012
- Cognitect - Transit (format specification, links to libraries and community resources): 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: http://www.cognitect.com/events/webinars

Avatar for Filip Zrůst

Filip Zrůst

October 23, 2014
Tweet

More Decks by Filip Zrůst

Other Decks in Programming

Transcript

  1. PragueJS 2014.10 Transit a format and set of libraries for

    conveying values between applications
  2. Context • Cognitect • Rich Hickey • Clojure, Ruby, browser

    https://twitter.com/bodil/status/522479098783072256
  3. Context - Marshaling arbitrary types - Exchange between languages -

    Verbosity of popular formats
 - JSON everywhere - Well-known - Fast parsers
  4. How • Plain old JSON when possible • Encoding not

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

    enclosing • Caching repeated values • Open type extensibility • Any element can be top-level
  6. 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
  7. How • Plain old JSON when possible • Encoding not

    enclosing • Caching repeated values • Open type extensibility • Any element can be top-level
  8. 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
  9. How • Plain old JSON when possible • Encoding not

    enclosing • Caching repeated values • Open type extensibility • Any element can be top-level
  10. 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
  11. How • Plain old JSON when possible • Encoding not

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

    enclosing • Caching repeated values • Open type extensibility • Any element can be top-level
  13. 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
  14. 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
  15. 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