Atlas Programming Model

A discussion of client and server development models for rich Web application development using Atlas, and a quick overview of the framework and runtime modes of the Atlas script library.

Atlas has been out for just about a month now and folks have been sharing thoughts. Various comments on my blog made me realize that we’ve been primarily talking about the "what" when discussing architecture, and features of the script framework, but haven’t addressed the "why". A programming model discussion might help address that. So, I chose to do that for a recent ASP.NET Insiders event. We had some good discussion that helped refine some of our thoughts. I’ll use this post to write on this topic. Hopefully this continues the comment discussion.

One key aspect of AJAX applications is their out-of-band communication with the server to eliminate or reduce post-backs. The interesting question, is what is transferred back and forth? Another interesting question is what logic runs where? These distinguish client-centric and server-centric development models.

The diagram depicts a client-centric development model from my slide deck. The server sends down the presentation, as well as UI logic during the initial request. This script-based UI logic runs on the client to handle user interaction, sends data to the server, and retrieves data (not HTML) in response, which it uses to further drive the presentation and content. The server exposes functionality, and other resources to the UI via services.

In a server-centric development model, the server often sends down HTML to the client instead of pure data in these out-of-band requests, and the client-side logic is considerably simpler. It is primarily responsible for making requests, and squirting in the response HTML into the right spot in the page. Most of the UI and interaction logic remains on the server.

The client-centric model allows implementing some compelling application scenarios, ranging from client-side computation to live data on the client. Imagine a master/details setup where editing a row of data in a list, causes the changes to show up in the details immediately without a network lag, because data is retained in-memory on the client and can be visualized in multiple forms simultaneously, and can be tracked for changes. This model also allows for more immediate handling of user actions and gestures, and the ability to perform snazzy visual effects (which can truly differentiate an app when used judiciously). The costs of this approach include writing significant client script, as well moving UI logic from server to the client, which entails learning, using, and building new tools, new patterns etc.

While some do love the new direction and its potential, some (very justifiably) respond with concern over the focus on scripting, and would prefer to stay in the realm of server-centric development where the guts of the application, including UI logic is implemented in something more familiar such as C# and with better tools. Incremental improvements in the application such as auto-completion, smarter grids etc. do not necessarily require a whole new model. While the UI is not as interactive as a true client application, it suffices for a class of applications. These scenarios are interesting to the overall Atlas vision, and a lot of feedback has been reinforcing that. You’ll see more and more of this part of the overall vision being fulfilled as the Atlas framework matures and allows developers to "Atlas-ize" and incrementally enrich their applications via server controls that balance client-richness with existing server-side paradigms.

So to try and address the "why" question around the script framework:

  • It enables a more disciplined and manageable approach to scripting via OOP patterns, and component patterns. Atlas also provides abstractions over raw JavaScript and DHTML to create an application framework that has largely been missing from the browser platform. Essentially a goal of Atlas is to enable tapping into the capabilities of the platform for use in "real" apps, so the client-centric model can in fact start to become real.
  • In another sense, Atlas is an enabling technology that simplifies the development of richer component development. Server controls already use script to varying degrees. Atlas provides a better substrate or runtime for control developers to target than just raw JavaScript and DHTML.

A lot of what you see today is a focus on client-centric development, as the groundwork is laid out. However, Atlas is about addressing both rich Web application development models: directly with a client application framework, and indirectly, by enabling server controls to target a better runtime.

<aside>
One thing to point out about the client-side approach is its remarkable similarity to how a smart client application or a mashup-type application might interact with the server. The idea is that your ASP.NET server-side infrastructure, services, and resources could be shared and leveraged across multiple applications and/or presentation platforms.
</aside>

One other dimension to the programming model, especially for those who are indeed fluent in scripting, is the choice of abstraction level when using Atlas. In order to address the varying needs, Atlas can be used in framework mode or runtime mode. Think of these as different packagings of the script framework presented in the layered architecture diagram.

We recognize that some developers will prefer to work directly with DHTML, as they have done so in past. These developers might be interested in building on top of the script core, and using it for things such as the OOP type system, APIs added to core JavaScript objects, the WebRequest/WebResponse abstraction over XMLHTTP and script proxies in order to call into Web services. This functionality is packaged into AtlasRuntime.js which comes in at about 10K today (assuming compression via IIS). The idea is to keep it as minimal as possible.

The Atlas "framework" could be thought of as the Atlas script framework in its entirety (sans auxiliary functionality such as drag/drop, mapping etc. that are to be included on an as-needed basis). In addition to the script core, this includes the component and UI framework, and a library of components, controls, behaviors etc. that abstract DHTML and the DOM to a certain degree. For example, you can use a Timer and subscribe to its tick event instead of window.setInterval. You can use bindings to transfer data across different parts of your application, instead of manually listening for change events, and implementing script event handlers, or use behaviors to package functionality and attach them to UI elements. Finally, you can choose to declaratively specify behavior instead of doing so imperatively using XML script. These are all different flavors of abstractions. The Atlas "Framework" is packaged in Atlas.js, which is about 30K today.

You might find both modes relevant in the same application. The runtime mode might be suitable for something like a home page for a site, which contains relatively little logic, and could in fact preload the framework, thereby making it available for immediate use on subsequent pages that are more involved.

Posted on Friday, 10/14/2005 @ 10:36 PM | #ASP.NET


Comments

9 comments have been posted.

Kevin Daly

Posted on 10/15/2005 @ 12:50 AM
I'd actually like to pick up on your aside: the similarity between the client-side approach and a smart client scenario highlights the point that, barring things such as security-related incompatibilities, if you have a smart client solution then the data communication facilities needed for an Atlas application may be already in place. This may offer a way to provide an acceptably graceful degradation of the UI for clients who owing to platform incompatibilities or for whatever other reasons may not be able to use a Windows Forms, WBA or WPF/E smart cient directly.
...Which also means that those application types may after all become viable options for deployment over the public internet rather than being restricted to intranet scenarios.
Ironically therefore, rather than AJAX being the death of the Windows smart client as some seem to imagine (or sadly, *hope*), Atlas (with its web service support, even if that's a little limited from the security point of view) could act as an enabling technology for the smart client by giving us something to offer other users without going back to the drawing board.

Steve

Posted on 10/15/2005 @ 1:48 PM
Great article - thanks.

I'd say right now I'm unable to use Atlas mostly because of documentation - the more documentation and examples that become available, the 'easier' I think it will be to understand how it works.

Also, I think when VS 2005 is no longer beta - that will make the move and study of it more available.

I like it's overall concept and idea.

Thanks

Richard Reukema

Posted on 10/15/2005 @ 2:55 PM
The world between the client-centric model you describe with Atlas, and a smart client is what I am currently pondering. My current project is to advise a client on how to best deliver his application to a disbtributed set of clients and not get into trouble with corporate firewalls. The UI is very complicated, and I'm leaning towards the smart client application. As these are both really new technologies, I would be interested in hearing more of the comparisions between the technologies.

Manish Agrawal

Posted on 10/17/2005 @ 11:42 AM
I'd say while designing the application, one should maintain balance between client-centric and server-centric model.

Primarily the main aim should be of transferring minimum data(no repetition/redundancy) over the network, but this will require transfer of presentation logic(Javascript) on to the client side, which(logic) in itself will consume network and client side resources(like CPU, RAM etc.), this will not be a good solution specially in the times when Mobiles are increasing getting used for net surfing.
Whereas server side model has advantages of Server side processing, rich tools for generating device independent presentation code etc.. but it results in more data transfer over the network most of the time(not always) and increases load on the server...

Thus each model has it`s own advantages and disadvantages....

Like while designing databases one has to balance between Normalization & DeNormalization. Taking into account both OLTP and DSS models...
UI logic must be divided between both client-centric and server-centric models as per the requirements..

Byron

Posted on 10/17/2005 @ 6:27 PM
I developed a Router.htc and later .js that we've used since XMLHTTP was released. We got only 3 framed pages that only get loaded once, after that it's total XMLHTTP web application. We actually transfered dataset diffgrams to/from the server it's works great and if/when we need to changed styles then we load them too. We do our own caching in memory, so styles don't need to be reloaded. We discovered that for data that changes, datasets are fine, but for lookup lists, datasets are actually larger then transforming them on the server and just sending the simple table class= html. Are Router is very simple just 3 methods AddMethod, AddParam, Send. We have one receiving webpage that can wireup any .dll. Return methods are simplar AddMethod, AddParam and then return packet.ToString. Multiple methods can be sent either way. I look forward to trying Atlas.

Steve

Posted on 11/4/2005 @ 7:59 PM
Will Atlas work with Visual Web express or C# express?

Ludmal de silva

Posted on 12/4/2005 @ 11:40 PM
hi,
I love the concept. Ive used AJAX. And i tried Atlas. But I still find AJAX.net is easier than the atlas. I know its still on beeta. All the scripts libraries which atalas has r they plan to hide the implementation of it in the future ?

marius

Posted on 3/25/2006 @ 2:52 AM
Hi,

how can i build a client-centric app hosted in a plain html file?

M.Sendilkumar

Posted on 6/20/2006 @ 2:42 AM
i am not able to use ATLAS scriptin in .ascx control.Is there any solution for this?
The discussion on this post has been closed. Please use my contact form to provide comments.