Transit.js

Definition

Transit is a format and set of libraries for conveying values between applications written in different programming languages. ... Transit provides a set of basic elements and a set of extension elements for representing typed values. ... With Transit, schemas, convention, and context-sensitive logic are not required. ... Transit is designed to be implemented as an encoding on top of formats for which high performance processors already exist, specifically JSON and MessagePack.

Using a transit definition for reference, the transit library for the current language generates and interprets transit-encoded data structures. These mappings allow convenient (i.e., idiomatic), type-safe communication between applications.

Analysis

Although Transit is very powerful, it assumes that both the sender and the receiver are using transit libraries. So, for example, a JSON reply from an arbitrary web server is very unlikely to be in transit format. Fortunately, it may be possible to work around this limitation. Specifically, we can augment JSON Schema with an expanded list of types, using a Transit library to handle the conversions.

This approach does not have Transit's performance benefits; indeed, it adds two translations to every exchange of data. However, this may be an acceptable cost in many cases because of the benefits in code clarity. Specifically, like COBOL's Data Division, Transit allows data types to be defined in a declarative manner, then performs the necessary type conversions automagically.

To be continued...


This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r3 - 30 Sep 2016, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email