Posted by Michael Marth JAN 18, 2008
Posted in jcr, microjax, microsling, rest, ria, ujax and usling Comments 7
Ever since Gmail entered the Internet we have seen an ever increasing interest in the "client". Before Gmail (in the beginning of this century) the best practice for web applications was HTML pages that were dynamically generated on the server-side. The high level system architecture of such an application would usually consist of a data base, an application server of some kind that generates the HTML and the browser.
Fast forward to 2008: the world has changed. Let me highlight some differences to 5 years ago.
- The user experience of web applications is more of a concern and has been improved a lot. Consider Flickr’s drag-and-drop interface or iGoogle. While they were not technically impossible few considered to implement such an UI back then. In general, this means that more code is executed on the client (aka AJAX).
- Servers routinely pump out pure data (rather than markup) in formats like RSS or JSON. This data can be integrated and displayed on the client (see the whole mash-ups phenomenon). From the point of view of the application developer all he does is write the client.
These developments have an impact on the high level system architecture: the client actually does something (rather than just render documents). And more: the client consumes data from the server (rather than documents to render).
So where does the "business logic" reside now? There is a continuum of possibilities: on one extreme it resides exclusively on the server (this is the "old style"). Then there is AJAX applications, where usually some logic resides on the server and some on the client. And by now, there is also the other extreme: all logic resides on the client (Bob Buffone has a nice slide on this continuum, see his presentation, slide 9).
The clients are alright
Let us look at the extreme case "all logic on the client". It might seem an unnatural thing to do (especially if you spent the last years coding server-executed JSPs or PHP scripts). But consider the technologies used for building Rich Internet Applications like Flex or Silverlight. If you use such a technology it is quite obvious that the client exchanges nothing but raw data with the server. Who in his right mind would let the server dynamically generate parts of a Flex application? Now, if you think about it, with an AJAX client the situation is not so different.
So in summary, it has become a perfectly valid possibility for an application design to place all logic onto the client.
The architectural change
If a certain amount of business logic resides on the server writing an application invariably means server programming. The server is your application.
However, in an architecture where the server just persists data and serves it to a client where the application logic resides this is necessarily the case anymore. If there is no application logic on the server then the server is just a piece of standard infrastructure much like a RDBMS is today (most people do not code business logic into their data base. Oh well, yes, some do). It just sits there, but there is no coding to be done on it.
Meet microjax
This type of application architecture is what David Nuescheler is aiming at with microjax. Let the client do the UI (because the client-side technologies are so much better at that) and let the server serve the data.
In microjax you have a (JCR) content repository and a very thin layer on top that reads and writes JSON. This means that the server-side is not split into the classical database/application server combo. Your data is your web server. The mapping between data and JSON output is implicit and does not need any explicit coding. The access rights are in your JCR (on "row level" in db lingo).
Let me highlight some implications of this:
- There is no need for server-side scripts.
- There is no need for db drivers. A REST interface is the "driver".
- There is less need for server-side CPUs. The clients bring their own.
- Web application development requires only HTML and Javascript skills (no PHP, JSP, ASP, …) which is around in abundance and the artificial boundary between web designers and server developers that translate their work into server code is gone.
See here to get started with microjax.
In the blogosphere
Who else is on this case? Peter Svensson has been exploring similar ideas (see his blog post The End of Web Frameworks and the follow-up Alternatives to Server-side Web Frameworks.
Even more, for his project Mashupstation Peter has come up with these interesting rules for application development:
1. All functionality that possibly can be implemented on the client side shall be implemented on the client side.
2. All communication with the server middleware shall be constrained to service-interfaces; For instance REST.
3. No part of the client shall be evoked, generated or templated from the server-side. This rules out in-line conditional HTML in JSP, ASP, PHP, etc.
4. The logic making up the server middleware will be implementing only the following functionality:
a. Security
b. Database access
c. Cross-domain proxying for remote resources implementing only a) and b).
These rules could have been taken from the microjax textbook it seems to me.
Back to the continuum
As I described above, the "all logic on the client" case is an extreme case of a continuum. But this extreme case might not be the right choice for each and every application. Luckily, microjax is part of microsling. Microsling allows application developers to execute server-side scripts that are implemented e.g. in Javascript. As such, the application developer can freely decide how much logic shall reside on the server and how much shall be on the client. Since both environments are coded in the same programming language moving logic back and forth is rather seamless (to get started with microsling see here).
IBM "gets it"
From the high level architecture view microjax and CouchDB are very similar. Both combine persistence (without prior structure) and a web server. Now, IBM has recently bought CouchDB.
IBM’s employee Patrick Mueller blogged about this purchase:
It's a web server and a database. And to me, this is the most interesting point. Just as we've seen client programs start to embed web browsing technology (like iTunes), there's really no reason why server programs like a database shouldn't be able to embed a web server.
Apparently, Big Blue considers the architectural change described above to be relevant.
As a side-note: while microjax and CouchDB are similar in ideas, but they differ in maturity. JCR implementations like Apache Jackrabbit (upon which microjax is based) have been in production use for years. Plus, there are tools for using them efficiently.
And another note: the "without prior structure" bracket above is further explored here.



I am happy to be back at