Finally, the cone of silence is lifted.

I'm one of the lucky ones to have a few months of hands-on with .NET 2.0, and it really is as cool as the demos look. While the brain-feeding frenzy goes on in L.A., I'll share a few of my favourite things here.

Partial Types. If you've been following the C# spec you know that partial classes are part of v2. At first glance the ability to split classes among files might seem like a can of worms, but oh, what artful worms we're seeing unleashed.

What does it mean to be able to split WebForms code among more than one file? You think you've seen effective code generation? Just wait until you can generate data structures and update corresponding queries to reflect an evolving data model from an XML schema you share with the DBA. There might come a day no one gets strangled every time tables or fields are shuffled or corrected during development.

MasterPages. The hassle of supporting as many template mechanisms as there are websites will come to an end. The implementation is clean and simple.

TreeViews and SiteMaps. On their own, each is nice to have. One gives you nice menus, the other defines an XML structure that can drive your menus and breadcrumb controls. So together, they make site administration a breeze. While testing these I had a bit of trouble getting the same XML file serve both controls, and the problem was that I overcomplicated things. The awesome documentation turned out to have all the answers I needed. The solution was so much easier than what I was trying to do that it made my day. Not only should I get out more, I was able to.

I have a minor gripe with rendering TreeViews in non-MSIE browsers, but it's cosmetic, not functional, and fixable. Heck, maybe it's fixed in the PDC release, I'll report when I get the newer bits. Speaking of which. . .

Cross Browser Support. I feel comfortable dropping any WebForms control on a public site, I'm completely satisfied with the way they render in Opera or Mozilla. The ASP.NET team did an amazing job of replicating MSIE effects on other browsers. I hope the effort and the feat helps dispel the idea that .NET doesn't respond to the needs (and the use cases) of the real world.

Declarative Model. Reducing the amount of code developers need to write by 70% from v1 to v2 was an ambitious goal of the ASP.NET team. It was met or exceeded in two ways.

First, by continuing the arc of controls. The new controls provide functionality that remained time-consuming to write. For example, the integration of role-based authentication. I have a few sites that use a homegrown database-on-the-back ASP model, and I frankly haven't converted them all to ASP.NET because they work, and it would amount to a rewrite. Now I can migrate and keep my back-end intact. All the new controls will save you code, just as v1 was a breath of fresh air after everything that came before (from any vendor).

Next, a lot of that v1 code consists of parameters, methods to bind data, repetitive methods to respond to buttons, and so on. What's happened is that a lot of bulk that was on the C#/VB code side has been trimmed of the fat and the essential bits are now control declarations on the HTML-content side. Where you had code, you now have richer declarative controls. In the end your folders won't be 70% lighter, but 40-60% would be reasonable. You will certainly write fewer lines of code and pull out fewer handfuls of hair getting it all to work together.

And finally, I'm happy to welcome a few new events to the Page Event model. Pre- and Post- events now exist for all stages in the cycle (though there is no PrePreRender). This is more of a comfort thing than anything else, with all there is to play with, I haven't even found the time to make use of  the new events.

I was going to stop at the first one, but damnit, it just feels good to have that cone lifted. Until next time.

No Comments