Wednesday, September 22, 2010

From Microsoft to Open Source

Since earlier this year, I have been working on jQuery Templates, as well as some other contributions to jQuery. The starting point was an initial prototype by John Resig, sometimes referred to as his micro-templating proposal. I hope to follow this post with a series of posts on jQuery Templates.

But before beginning those posts I wanted to to give some background:

Microsoft and jQuery

At Microsoft, we had a pretty cool client templating implementation which Dave Reed and I created. This was part of the Microsoft AJAX Library. The client templates were integrated with live data-linking, and with a script loader. We also worked on some very interesting integration between all that and jQuery, so that if you were using jQuery you could get jQuery-style APIs for the MS AJAX features, and use selectors, fluent-style APIs etc.

But after reaching the point of releasing Preview 6, and getting very close to a final release, our management team decided to make a radical change. Client-side AJAX platforms are all about performance and optimization of Web requests, and in a sense we were in a contradictory situation. - We were encouraging our developers to use both the MS AJAX platform and jQuery in their client apps, but inevitably there was some overlap and the inclusion of both platforms in their apps was not completely optimal.

So the change was that from that point on we would not just provide support for using jQuery alongside our own client-side Microsoft AJAX platform. We would instead begin to offer contributions directly to jQuery.

In fact while jQuery has some very cool features, there were a number of features in our AJAX platform which were not in jQuery, and indeed were pretty much ahead of the curve as far as AJAX platforms in general are concerned - or at least that is my view :-). Amongst those features - our client templates, our concept of observable JavaScript objects and arrays (which we now refer to as "data-linking"), our globalization support, and our script loader.

Moving to Open Source

So we began the process of completely redesigning and re-implementing some of those features as pure jQuery plugins or extensions. The goal was very strongly towards lean and clean JavaScript code; to follow JavaScript best-practice for coding - in the sense of optimal use of the JavaScript language itself; and not to attempt to squeeze it into a strongly-typed or object-orientated (in the C# or Java sense) paradigm - or in general bring to bear coding habits and patterns that come from C# and are not really 'at home' in JavaScript code.

The work is taking place as a true open source effort, hosted on GitHub, and in touch with the community. I have been having a great time as a developer working in that context, and enjoying every minute of it!

So far we have three projects on GitHub: jQuery Templates, jQuery Data Linking, and jQuery Globalization. We are also working on bringing our original Script Loader code into a form that might be optimal for jQuery. The globalization plugin was announced here, and is already seeing a lot of use. jQuery Templates has been under very active development recently, and will be the subject of some of my upcoming blogs. And jQuery Data-Linking will probably see some more intensive development in the coming weeks, and is likely to include some very interesting integration with jQuery Templates...

I am looking forward to sharing more of these Open Source efforts with you over the coming weeks, starting with a series of blogs introducing jQuery Templates...

5 comments:

  1. Thanx! I'm very interested in the Script Loader code. Any info on that yet?

    ReplyDelete
  2. Very cool. Exciting to see where pushing forward on the OSS front.

    ReplyDelete
  3. @Robert: No, not yet, but we are actively exploring that area.

    ReplyDelete
  4. Boris, thanks for this post. I was wondering what happened that caused Microsoft to withdraw Microsoft AJAX Templating from the 4.0 release.

    I suspected something similar to what you say.

    I used the preview implementation of MS AJAX Templating in two projects that are now in production, and am still recommending it to customers now, exactly because it is so much ahead of the curve.

    I loved the fact that by using the AJAX templating solution, the development paradigm of an HTML web application became _identical_ to that of a Silverlight application. HTML Templates can be designed by a "designer (person)", and databound to data that is kept in sync via data binding.

    I am trying to transition into using the JQuery implementation of jquery-tmpl and jquery-datalink. The new implementation does show some potential, however it is still missing some crucial components.

    For instance:
    - two way declarative binding
    - Behavior / plugin declarative instantiation.
    - Observable Collections, so adding an item to an array would immediately create a new instance of the template.
    - Event bubbling.

    Basically, if I can get to an implementation of a Master / Detail with automatic selection change and data update completely declaratively, I will be satisfied.

    Finally, thanks for the great work you did with MS AJAX templating. I hope you will reach a similar level with the JQuery implementation.

    ---
    Adar Wesley

    ReplyDelete
  5. @Adar: Thanks, and yes I completely agree. I'm currently working hard towards exactly the kind of developments you suggest aimed at bringing jQuery to (or rather, beyond) the level of MSAJAX templates :-).

    ReplyDelete