ASP.NET, Atlas, Windows Forms and WPF

One of the challenges of trying to write a blog like this is getting the level right. I'm conscious that some of my readers are expert "Avalonians" who have been working with the technology since PDC 2003, whilst others are just coming across this technology for the first time or starting out. I try to post things that are interesting at several levels at once, or at least make sure that there's something for everyone. Anyway, this is an extended preamble into a number of positioning questions I'm frequently asked. I figure that it would be somewhat more efficient for me to handle them here on the blog so I can refer others back to them, rather than writing the same reply via email once a week!

How do Windows Presentation Foundation, XAML and ASP.NET fit together? I've heard you can build web applications using XAML - does that mean that ASP.NET is dead?
Windows Presentation Foundation uses XAML for constructing user interfaces, certainly. And you can use WPF to build applications that run in a standalone window or in-browser, that's true. But both classes of applications are smart client applications, that is to say that they require the WinFX Runtime to execute. The browser application model in WPF allows for really rich, visually immersive applications to be deployed via the web in a secure manner. However, you're not running HTML when you run a XAML Browser Application (XBAP) - instead, you're simply loading a compiled application within the confines of a browser. ASP.NET is very much alive - it's our server platform for building HTML applications.

OK then, so I've seen comments about "Atlas forever changing the way web apps are implemented", how does Atlas fit into the whole WinFX picture?
Atlas is an extension to ASP.NET that makes it simpler to build AJAX applications. It enables web applications to become more dynamic - loading data without requiring a complete page refresh, for instance. We'll ship Atlas as part of "Orcas", the next release of Visual Studio. Atlas is a great way to add greater interactivity to a web application, but it doesn't approach the richness of WPF. For example, it doesn't include support for 3D, animation, or any of the other deep services in WPF - at the end of the day, the browser is still rendering DHTML scripted with JavaScript.

Right, I get it. So WPF is the new rich client technology for building web and standalone applications in WinFX. Where does that leave DirectX and Windows Forms, then?
Well both technologies are alive and healthy. In fact, Windows Presentation Foundation does its rendering via DirectX, so that's not going anywhere. The truth is that since WPF provides an abstraction layer over the underlying technology, DirectX is still the best choice for the highest-intensity 3D applications. For example, I don't think we're going to see games like Far Cry written using WPF any time soon. In applications where the highest priority is 3D performance and coding to the metal is the order of the day, then DirectX is the best choice. Where you're prepared to sacrifice a little performance for developer productivity and great integration across 2D, 3D, text, animation and media then WPF is the perfect tool.

As far as Windows Forms goes, the current release as part of Visual Studio 2005 demonstrates a level of maturity and strength that is enviable. It's the culmination of the last twenty years of development based on the GDI/GDI32/GDI+ platform. It'll be around and supported for many years to come, there's a great ecosystem of controls and plenty of trained developers. WPF sets off in a new direction, building on a new architecture that we hope will last us as long as the GDI world did. The potential with this platform is to build applications that would be completely impossible in Windows Forms, setting a new bar for usability and user experience. We haven't yet released our first version, so there are inevitably a few minor gaps and limitations, but for new applications this is a fantastic emerging platform to build on for longevity. By the way, if you've already built an application with Windows Forms, it's not an either/or choice - we have good interop support and you can embed a Windows Forms control into a WPF application or vice versa. Some early adopters have dipped their toes into the water by building a new WPF visualization or component for their existing application using the interop layer.

Last question. Windows Forms, ASP.NET/Atlas, DirectX, WPF, Win32 - that's five UI technologies to choose between. How do I decide?
Really the variety of choice isn't such a bad thing - it enables you to pick the best technology for the job rather than having to pick a lowest common denominator that tries to serve all masters and ends up serving none.

  • Building a forms-based application and looking for a mature technology to use with good tools and component support? Check out Windows Forms - it's got everything you'll need to turn out a well-designed, service-orientated client application.
  • Is platform ubiquity or wireless mobile device support the high order bit? ASP.NET with or without the Atlas extensions is a good technology to choose. (Don't forget about the .NET Compact Framework for rich mobile devices, of course.)
  • Want to build a first-person shooter game, a CAD/CAM workstation application or something similar where polygon count is the major technical requirement? DirectX is a natural choice - don't forget that the .NET managed APIs for DirectX are maturing rapidly and starting to be worthy of serious consideration.
  • Looking for complex data visualization, superb text flow content rendering or dynamic interactive experiences? WPF should probably be your top choice. I'll be posting in future entries about a few sweet spots that early adopter customers have been exploiting to great business gain.
  • Lastly, don't let all this talk of managed code convince you that Win32 is anything other than a vibrant general-purpose way to build applications. There are thousands of new API functions in Windows Vista for Win32 developers to do everything from integrating with the Aero Glass theme to implementing live preview icons and ink-enabled applications. Don't write off Win32, or let others convince you that it's no longer core to Microsoft. It's the platform of choice for tens of thousands of applications. Long may it continue!