Raise a glass to TOAST, a preprocessing service converting XML to JSON

TOAST is a new project recently released by the UI team here at MediaMath. The name stands for “TerminalOne App Server TOAST,” following the long-standing tradition of recursive acronyms in software (and adding to a relatively shorter list of more “exclusive” tail-recursive acronyms … but I digress).

“What is TOAST really?” one might ask.

TOAST

The answer: TOAST is a web service layer that sits between the T1 front-end (the UI on our primary product, TerminalOne) and the services upon which the UI relies. It may ultimately provide a number of features for T1 that, typically for performance reasons, are preferably handled “for” the client rather than “in” the client: template compiling; entity caching and synchronization; aggregating the results of multiple service requests into the response for a single compound request; and automatically retrying failed requests to other services given certain constraints.

In its first release, TOAST will provide uniform conversion from XML (Extensible Markup Language) to JSON (JavaScript Object Notation) on responses to requests made on behalf of T1. The goal with this release is to remove the performance burden from the client by providing a preprocessing service within the server.

Some of the services T1 leverages exchange data with clients in XML. While XML is a rich data format for expressing information, it can be cumbersome to work with at times, especially in front-end development where JSON is typically preferred. This is because XML is relatively verbose compared to JSON, and JSON is interoperable with JavaScript – the realm in which most front-end logic is orchestrated and executed – in a way that XML is not. Before we released TOAST, T1 had to convert XML from many service responses into JSON within the client.

As is commonly preferred, we wanted to move this preprocessing to the server where greater advantage can be taken of caching, and the performance burden on the client can be lessened. With TOAST, we can provide this preprocessing service.

The first consumers of the TOAST service will be the data-encompassing elements of the UI team’s new Strand framework, which is being developed on the cutting edge Polymer Project and Web Component technology. Web Components are magnificent, and really too broad a subject to cover here. However, suffice it to say that the manner in which Strand leverages Web Components to encourage consistency in front-end feature implementation – through simplistic composition of reusable modules – makes the framework the ideal place to manage interactions with TOAST. As T1 gradually incorporates more pieces from Strand, TOAST will become more deeply integrated into the backbone of the application.

TOAST runs on Node.js, a platform in which most of the logic is executed in JavaScript. Node.js is a lot of things, but more than anything it is an instance of the rapid adoption of a new native and server-side development platform that had rarely been seen before in the history of computing. There are several reasons for the its recent popularity, including but not limited to:

  • The appeal of isomorphic JavaScript, a language ubiquitous among front-end developers eager to control their own destinies on the back-end
  • The (only recently) emerging feasibility of such a platform due to several waves of performance improvements to JavaScript engines resulting from the “browser wars”
  • JavaScript’s innate compatibility with a number “schema-loose” NoSQL databases concurrently rising in popularity, especially document stores that rely on JSON (such as MongoDB and Couchbase)
  • The simple utility of NPM (Node Package Manager) and the effortlessness of sharing modular open source code in the “Post-Github” era

The promises of Node.js alone were compelling enough to select it for this project. The opportunity to leverage the UI team’s JavaScript fluency to rapidly implement features desired for the front-end that require work on the back-end was the icing on the cake. Factor in that developing TOAST should have little to no impact on the workload of other engineering teams, and what you are left with is a cross-team crowd-pleaser.

The story of TOAST is far from over. There are a lot of features left to develop, and operational tools for testing and deployment are going to be getting a lot of love in the coming months. Nevertheless, TOAST’s initial release will be the first step of many taken to improve the experience for the users and developers of T1 alike – and the best is yet to come.

A Picture of Justin Moore

JUSTIN MOORE

Developer, UI Framework Team Justin Moore is a developer on the UI Framework team at MediaMath, where he specializes in finding unconventional solutions to difficult problems. He’s fascinated by programming languages and their design, and focuses on writing code that writes code. Before joining MediaMath, Justin developed casual games for Xbox and iOS. He also cofounded Tap.Me, a startup mobile game advertising platform that was acquired by MediaMath in 2012. He earned a Bachelor of Engineering in Mechanical Engineering from MIT and completed a two-year Video Game Development program at Flashpoint Academy (now Tribeca Flashpoint Academy). He digs static analysis, collaboration technology, and thinking about thinking.
0 Comments.

Leave a Reply

Your email address will not be published. Required fields are marked *