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

Transferring application data efficiently with Transit

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

969032d35b52cb11615786229e80ede7?s=128

Filip Zrůst

October 23, 2014
Tweet

Transcript

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

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

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

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

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

    Verbosity of popular formats
 - JSON everywhere - Well-known - Fast parsers
  6. What • Data exchange format • Languages agnostic • No

    schema • Extensible • Efficient
  7. But JSON…

  8. Why • Limited types • Verbosity • Top-level elements

  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
  11. 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
  12. How • Plain old JSON when possible • Encoding not

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

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

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

    enclosing • Caching repeated values • Open type extensibility • Any element can be top-level
  18. 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
  19. Price • You write readers and writers • Human readability

    is not a goal
  20. Example

  21. 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
  22. 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
  23. Thank you and something about me… Filip Zrůst @frzng Freelancing

    naysayer FP enthusiast Idealist