A few weeks back now, we started the development of our new web application BeeLit.
Of course we had to make several important choices for our IT architecture.
We started by choosing a light, flexible and really fast back-end as mentioned in our post: Why Erlang ?
For the front-end, we wanted the browser to be the center for rendering and aggregating services. (Read our post about True Aggregation, the Browser as a Platform).
To achieve this goal, we had to decide for:
- a JavaScript library to ease the cross-browser issues and advanced DOM functionality
- a communication language between the browser and the back-end: JSON ? XML ?
- a template engine to render the back-end services in HTML
We chose jQuery as our JS library (the reasons of this choice will be detailed in a future post).
We decided to go for JSON as the preferred communication language between the browser and Erlang.
The main reason being:
JSON is JavaScript, and JavaScript is THE language of the browser that runs the client logic.
When an AJAX kind of call returns a JSON, your JavaScript code understands it natively.
When an XML is returned, in some ways, you have to convert it fully or partially to JavaScript variables. Then the data becomes useful in your browser. This remains true even if you use XSLT for the rendering.
Don’t get me wrong. It doesn’t mean that we are closing the door on XML and that we won’t aggregate XML services from other API’s in our solutions. It took almost 10 years for the IT Industry to replace ASCII files with XML. And nowadays, you can find plenty of API’s working with XML. So XML is here to stay.
But receiving JSON data in a browser simplifies the developer’s life dramatically.
(Read the rest of the article…)