Sunday, November 18, 2007

The coming frameworks; SOFEA, JDA, Squirrel and a taste of the future of web design

Yesterday, I saw that someone had created a full IoC container framework in Javascript, called squirrel. I have written (at length) previously about JDA (Javascript Dataflow Architecture) and its benefits for creating rich clients in Javascript, sometimes referring to it as "Spring for Javascript".

However, JDA is focusing more on being a pragmatic, easy-to-use (and understand) messaging kernel, for the web page where the rich client resides, rather than a full-out IoC implementation - which Squirrel certainly is!

The goal of both frameworks are of course to force the developer (Yes, that means you :) to modularize code, and not sprawl all over the page out of laziness (as usual). JDA is the more terse alternative, which defines functions called "Blueprints", with input and output "terminals", where each input terminal has a handler function inside the blueprint.

Blueprints can then be instantiated in the web page, and their terminals can be connected to each other (which makes it very easy to switch stuff out, if you change your mind about something) using properties in the HTML tags which JDA scans for after loading.

What I've seen in Squirrel so far (I must admit to just have read through parts of the code and examples), is that it very much resemble traditional Java containers like Spring or Hivemind. As in JDA, it uses the web page as a natural presentation layer, and pushes all functionality into separate Javascript files. One of these is a Mian defintion file, which takes the place of the same XML config file in (say) SPring. it looks like this;

$(function(){
var oCD={
'model':{type:Model,props:[{name:'view',ref:'view'}]},
'view':{type:View,args:[{ref:'model'}]},
'controller':{type:Controller,args:[{ref:'model'},{ref:'view'}],props:[{name:'containerContext',ref:'containerContext'}]}
}

var _oContainer = new IContainer();
_oContainer.load(oCD);
});

It relies on the model, view and container obejcts to be defined separately, which enforces a very strict separation of concerns. What is good about this is that it makes the transition to Rich Client Javascript programing easier for a programmer used to code in Spring, for instance.

The downside is that Squirrel requires (or seem to) a lot more files and "framework objects" than JDA do, which might make it harder to code in.

My remaining impression of Squirrel, though, is; "Wow! They actually did it! :) ". One of my first posts on this blog was actually about a joke about creating a "real" IoC container for Javascript.

Moving on to a comment on the Squirrel posting, I found a link to something absolutely wonderful, which seem to have missed my attention when it came in October; SOFEA - standing for Service-Oriented Front-End Architecture.

SOFEA is an architectural style which in its definition criticizes (and manages to make a very good definition of) the current web frameworks, and (as they say) "none of them satisifes".

If I would summarize the SOFEA proposal (which I'm currently attempting) I would describe it as a clear analysis why generating the client out of the server, and forcing presentation to predefined pages and actions are inherently bad, and inefficient.

Incidentally, this ties very well into my own four principles of web application design : )


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, et.c.
4. The logic making up the server middleware will be implementing only the following functionality;
  1. Security
  2. Database access
  3. Cross-domain proxying for remote resources implementing only a) and b)
And just like the SOFEA proposal this scraps all major web application frameworks like JSF, Struts and the like (even tapestry, which i kind of like still ..)

Cheers,
PS

No comments: