Geeks With Blogs
Greg Woods Software Developer, Flight Sim Geek, and Snowsports Addict

I've been spending a few days looking at the Microsoft Atlas CTP tools and samples. http://atlas.asp.net . It's been an uphill battle with poor documentation being largely to blame. It probably doesn't help that I had some very specific ideas about what I wanted to accomplish using an Ajax framework, and it's difficult to map my requirements with features of Atlas.

At first glance there appears to be plenty of info on the Atlas website, but it's poorly organised and quite shallow. It's good at showing what can be done, but pretty poor at showing how to leverage it in your own code. The whole site seems to be more of a technical sales site than source of real info. It could just be that none of it appeals to my learning style. Comments welcome on your own experiences with the site.

As to Atlas itself, it does look impressive. The sales job worked! The underlying javascript object model looks superb. The declarative programming model built on top of it looks promising, but as a web developer, it's something else that's completely new to learn. It seems to be another attempt by Microsoft to make the nasty world of web development, with it's mix of server and client side processing, into a more fluffy warm place for softie Windows Forms developers :)

Anyway, I'm going to look at one of the samples and try to dissect it. It's a client side only example, so you could even use it ona classic asp or even an html page, by removing the server side ScriptManager tag (and other 'runat="server"' attributes) and replacing with an html script tag linking to Atlas.js.

Brief Dissection of a Sample

Demo: http://atlas.asp.net/docs/atlas/samples/controls/simple2_control.aspx

Source: http://atlas.asp.net/docs/util/srcview.aspx?path=~/atlas/samples/controls/simple2_control.src

I'm going to look at the second example on this page. (I wish they'd stick to one example per page) I've simplified further by highlighting just one button, the visibility button.

Input Field:

<input id="textBox" type="text"/>

Corresponding Declarative client side markup:

<textBox id="textBox" text="Simple text box control" cssClass="textBox">
    <bindings>
        <binding id="setVisibility" dataContext="textBox" dataPath="visible" property="visible" transform="Invert" automatic="false" />
    </bindings>
</textBox>

Visibility button:

<input type="button" id="visibilityButton"  class="buttonstyle" value="Toggle Visibility Property" />

Corresponding Declarative client side markup:

<button id="visibilityButton">
    <click>
        <invokeMethod target="setVisibility" method="evaluateIn" />
    </click>
</button>

Description:

What follows may not use Microsoft's terminology, just the terms that make sense to me. After all, this page is mostly to help me understand what is going on.

I originally thought it odd that the <click> calls a <binding> which acts on the <textBox>. Why the 2 step approach? Why not <click> which acts dirctly on the <textBox>? A little digging and experimentation showed that for many actions we can miss out the <binding> stage. Whilst looking up invokeMethod from the client library reference http://atlas.asp.net/docs/Client/Sys/Action/default.aspx I discovered that invokeMethod is one of 3 actions. The others are postBack and setProperty. We could set a property using:

<button id="visibilityButton">

    <click>

        <setProperty target="textBox" property="visible" value="false"/>

    </click>

</button>

This doesn't help us to toggle though. It makes the control invible but can't make it visible again. In imperative code this would be done with an if...else block. To avoid that Microsoft added the transform="Invert" property to the binding. More information of the <binding> control and the transformations built in here:

http://atlas.asp.net/docs/Client/Sys/Binding/default.aspx

http://atlas.asp.net/docs/Client/Sys/BindingBase.Transformers/default.aspx

 

Concluding Advice

I already had a UI design I wanted to implement using some Ajax framework, and I wanted to do it as quickly as possible. If you're in a similar position, SLOW DOWN! Start with really really simple examples that you code yourself. Don't be content with the MS examples. They look good, but until you do it yourself, you won't learn a great deal. I know we all know this already, but we're also all impatient and want to take shortcuts. Don't! This is brand new stuff with new concepts, and it all needs time to sink in. If you need inspiration for your own sample code, just think of common things you do in javascript in your web pages already. Show/Hide toggle, show an error message when values are incorrect, show a popup when something is wrong, Change enabled/disabled status depending on values in other controls etc.

Current thoughts on Atlas

It's very promising. My main worry is that the Declarative script is a brand new syntax to learn, and it's very, proprietory. It's anyone's guess how long it'll last, especially with XAML being touted as the next big thing. By the time I've finished my evaluation of Atlas, I may come to conclusion that it isn't worth using the declarative code. The alternate javascript model is very good, and it's familiar to any web programming team. Also, javascript Atlas looks much more compact, and can be put into an external js file for local caching. All these advantages come with other frameworks as well. The Yahoo UI Library looks very good, and has much more complete controls for dropping straight into pages. Wheter it's as suitable for building on top of, I don't know.

All comments welcome.

Posted on Tuesday, July 4, 2006 12:20 PM .NET , Software Development | Back to top


Comments on this post: ASP.NET Atlas CTP First Look

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Greg Woods | Powered by: GeeksWithBlogs.net