Wednesday, July 4, 2007

Introduction to .NET 3.0 for Architects

Posted by Mohammad Akif

The latest version of Microsoft's .NET, .NET Framework 3.0, opens up new possibilities for developing the next generation of business solution software. It is designed to enhance productivity, reduce infrastructure plumbing, provide an identity meta-system, and facilitate development of enterprise-class services, work flow solutions and immersive user experiences.

During my discussions with a wide variety of architects I have learned that Solution Architects care very much about security, open standards, interoperability, services oriented architecture, relationship between key technologies (for example Workflow Foundation and Biztalk) and productivity. In this article, I have attempted to provide a description of .NET 3.0 in terms of areas that are of significant interest for the architect community.

.NET versions

It has been almost six years since Microsoft released the first version of the .NET Framework. The 3.0 incarnation is the first framework being distributed with the operating system, i.e. with every Windows Vista installation and is also supported on Windows XP SP2 and Windows Server 2003. Until .NET 3.0, each version of the .NET framework was also accompanied by a new Common Language Runtime, hereafter referred to as the CLR. Microsoft has not modified the CLR for the 3. 0 version of the .NET framework and this is an important point to understand.

As .NET 2.0 and 3.0 share the same CLR, everything written in .NET 2.0 works in .NET 3.0 which is an important and significant departure from previous versions. In terms of change, for those who love algebra equations the relationship can be summed anecdotally as:

.NET 3.0 = .NET 2.0 + WCF + WPF + WCS + WF

I will provide a definition of each of the acronyms, but anytime you get confused about the relationship between .NET 2.0 and 3.0, keep the above equation foremost in mind. One of the key philosophies behind .NET 3.0 is to provide functionality that can be considered ‘infrastructure plumbing' as part of the framework. This allows you to focus on your key business problem.

The .NET Framework 3.0 achieves this objective through four key standards-based pillars corresponding to areas identified and requested by our customers. It also introduced a key new language called XAML. XAML is a declarative XML-based language that defines objects and their properties in XML allowing customers to develop workflows (WF) and immersive user experiences (WPF) declaratively. Let us explore the key pillars of the .NET 3.0 framework in greater detail.

Windows Communication Foundation (WCF)

WCF allows you to architect services by offering a standards- based framework and a composable architecture. The three key design philosophies for WCF are interoperability, productivity and service-oriented development.

Microsoft provides a number of messaging layer channels and service model layer behaviors that can be added and removed easily. It also allows you to define your own custom instances, for example you can write or buy a custom encoder for ASCII and insert it as a reusable channel in the messaging layer that can be used across various systems. WCF interoperates with existing investments and combines and extends existing Microsoft distributed systems technologies like Enterprise Services, System.Messaging, Microsoft .NET Remoting, ASMX and Web Services Extensions (WSE). This change implies that you can use a single model for different types of application behaviours which significantly reduces the complexity in application development. WCF also offers interoperability with non-Microsoft applications through support of the WS-I basic profile and a number of additional WS-* standards.

Finally in terms of productivity you can get a significant order of magnitude difference in developing secure transactional web services using WCF. Think of WCF as tens of thousands of lines of code that you would need to develop, generate and maintain, but instead are provided now as part of the base framework. WCF offers one of the first core programming frameworks that have been designed from the ground-up for services oriented development.

Windows Workflow (WF)

Workflow Foundation is an enterprise class workflow development framework and engine that has taken declarative workflow mainstream for the first time. WF supports human, system, sequential and state-machine workflows. It provides runtime infrastructure, flexible flow control, long running and stateful work flows and runtime and design time transparency and auditing capabilities for compliance and record management.

Workflow Foundation allows you to define a workflow as a set of activities. Activities are the unit of execution and allow for easy re-use and composition. Basic activities are steps within a workflow while composite activities contain other activities. You can add and remove activities even when a workflow is already in progress allowing you significant flexibility in terms of change. Workflow Foundation provides a base activity library out-of-the-box and a framework for partners and customers to easily author custom activities.

In terms of authoring options, you can use XAML mark-up only, mark-up plus code or code-only. Visual Studio 2005 Designer for Workflow Foundation is available as a downloadable plug-in and provides a drag-and-drop design surface, intuitive graphical tools, integration with the Properties window, debugging and graphic Commenting capabilities.

A number of architects have asked me about the relationship between Workflow Foundation, BizTalk, Microsoft Office SharePoint Server 2007, (MOSS 2007) and Windows SharePoint Services (WSS).

Workflow Foundation, (WF), was developed by the same team at Microsoft that developed the BizTalk workflow engine and is intended to be utilized by BizTalk Server in future versions. WF provides the foundation for implementing workflow scenarios mostly within an application and between applications in certain cases. BizTalk allows you to automate your business processes, orchestrate processes comprising of systems implemented in different technologies through adapters and provide advance business activity monitoring capabilities.

In terms of MOSS 2007 and WSS, MOSS 2007 is built on top of WF and provides additional functionalities and features using WF for the base functionality. Windows SharePoint Services provides a subset of the functionality of MOSS 2007 as an add-in to Windows Server. Simply put, WSS provides simple document management capabilities and workflow.

Windows Presentation Foundation (WPF)

Windows Presentation Foundation attempts to bridge the gap between the immersive user experience typically found in the gaming and entertainment industry and the static and hard-to-use world of business. WPF uses XAML extensively to allow you to develop the next generation of interfaces without becoming a graphic designer yourself.

I would encourage you to see a demonstration of a WPF application to understand what I mean by the next-generation user interface. You can, for example, view fifteen of the most precious books present at the British Library (http://www.bl.uk/ttp2/ttp1.html ) including Mozart and DaVanci hand-written notebooks. This reader is a WPF based application hosted in a Internet Explorer browser session and is referred to as an XBAP, the technology meant to replace ActiveX in the browser functionality-wise. The key differentiator for WPF is not the end product, a wonderfully rich interface, but actually how easy it is to develop and maintain the application code.

From an architectural perspective, WPF maintains a very clear separation between the graphic element and business logic. A designer will use the Expression product line and XAML to build the view, while the developer will use Visual Studio and write code using VB.NET or C#.

Another technology that has received a lot of attention lately is WPF Everywhere, (WPF/E), which is now officially called SilverLight. Please note that SilverLight is not part of the NET 3.0 framework. SilverLight is a cross-browser, cross-platform plug-in with its own runtime for delivering the next generation of Microsoft .NET-based media experiences and rich interactive applications for the Web. You can find out more information about SilverLight and view the demonstrations at http://www.microsoft.com/silverlight.

Windows Card Spaces (WCS)

In today's world, everyone carries a number of self asserted and third party issued identities. Examples of these identities include driving licences, credit card, cinema card and others. We have control over the information we use to prove our identity to the requesting party. Windows Card Spaces extends the same concept of user control to the digital world. WCS creates an identity meta-system that can significantly improve the way enterprises manage identities within their organization and between different organizations. To understand the potential, it has been praised by one of Microsoft's prominent critics as "one of the most significant contribution to computer security since cryptology.

In the digital world, identity can be expressed as subject (who), identity claims and security token (digital representation of subject and claims). WCS uses the concept of self-asserted and managed identities, a self asserted digital identity card could be used for signing up with a service like Hotmail whereas a managed identity could be a credit card issued by a bank. The following picture illustrates the protocol that is used to exchange information between the various entities. Please note that in this case the Identity provider could use Kerberos, X509 or a custom mechanism. Similarly the relaying party could use SAML or send the security token using HTTPS post.

WCS provides an overarching framework for various implementations of identity management technologies to work together. At Java One (which is the one of largest Java conferences in the world), Sun and Microsoft did a joint keynote demonstrating interoperability mechanisms based on WS-* standards. I have posted the link to the demonstration and the toolkit at my blog mentioned at the end of this article.

Conclusion

The .NET 3.0 Framework opens up a new world of possibilities for both architects and developers. It is intended to make it significantly easier for you to develop, integrate and maintain application based systems. Microsoft plans to continue this same philosophy of reducing complexity and infrastructure plumbing while concurrently increasing interoperability and standards support for the future version of the .NET framework.

CLR Garbage Collector

Justin Smith presents the internals of the .NET Garbage Collector and how you should design your types to play nicely with it. Learn about heap allocations, the GC Algorithms, Multiprocessor considerations, and the IDisposable pattern.
Join the conference