Friday, January 15, 2010

What I Learned at PDC - .NET Platform and Extensions

In the late 90’s, the general consensus was that the Microsoft programming model was losing ground to JAVA. At that time, every product that Microsoft offered was COM(Component Object Model) based. And every language Microsoft offered produced COM programs. The COM programming model generated machine instructions targeted at the native instruction set of the CPU. JAVA, on the other hand, provided a virtual machine environment, so compiled JAVA code targeted the instruction set of the virtual machine (VM), which is an abstract CPU. JAVA was able to use its VM implementation to create the catch phrase “write once, run anywhere”, because all that was needed to execute your JAVA program on any OS, platform or device was an implementation of the JAVA VM. There was no need to recompile your JAVA code in order to run it on a new target machine, and as a result there was no need to created install programs to set up the target machine. ‘X-COPY deployment’ become another catch phrase because all you needed to do to install and run a JAVA program was to copy the binaries to a folder on the target machine and say run!

In early 2000 Microsoft released .NET, its own VM based programming environment. At the time, Steve Balmer described .NET as a corporate strategy, programming environment and a marketing campaign. All programming languages implemented in .NET (VB, C#, C++) would emit the same instruction set and target the VM. This makes is possible to easily create applications that mix languages. .NET also makes it possible to call into programs written in the older COM technology through a process called ‘interop’.

Throughout this decade Microsoft has been improving the .NET platform. Two new technologies that emerged in .NET were WPF (Windows Presentation Foundation) and WCF (Windows Communication Foundation). These technologies are the core components used for GUI and networking.

So what is new and improved in the .NET platform? Everything, starting with .NET itself.

The latest version of .NET is .NET 4.0. It should be noted that many of the productivity frameworks come in the box as part of the .NET 4.0 platform, and have also been back-ported to .NET 3.0 and VS2080 SP1. Many are also open source.

Language and Modeling Tools
.NET Framework (POCO, LINQ, Rx, IDynamic ) : it all starts with improvements to the .NET framework. POCO is an acronym for Plain Old CLR Objects (CLR is Common Language Runtime), and although POCO has been around since .NET 1.0, Microsoft is favoring this type of detailed definition for data binding and transportation over the existing classes like DataSet, DataTable & DataRow. I think it is because they work better with LINQ (Language Integrated Query).

LINQ is a fabulous technology (Wikipedia: Language Integrated Query) for lots of reasons. One of the most important, from a developer’s point of view, is that it reduces the interaction with any .NET data source (SQL, XML, CSV…) into a single syntax.

Rx, or Reactive Framework, was one of the surprises of PDC, and I did not even discover it until after the conference, online. The LINQ model is to pull data from a data source, where the Rx model reacts to changes in the data source and sends you a notification. The session VTL04: Rx: Reactive Extensions for .NET explains how it works. Eric Meijer leads the talk and he always wears a tie-dyed shirt, always.

IDyamic is the feature / interface I have been waiting for since the PDC08 demos. Dynamic languages defer compile type checking to runtime and in many cases this is very useful. Popular languages like Ruby (on Rails) use this technique exclusively. This, in conjunction with the DLR (Dynamic Language Runtime), will make is possible to extend the syntax of any .NET language. It offers better interop with COM based software, like Office and VB6. The DLR is also a major component for languages like Iron Ruby and Iron Python. Mads Torgerson gives a solid talk on the development history: FT31: Dynamic Binding in C# 4. Luck Bolognese gives a talk that shows using the technology: FT11: Future Directions for C# and Visual Basic.

Adding dynamic characteristics to existing languages follows the theme of programming in a declarative style instead of an imperative style.

I will finish this topic in my next post on PDC, where I will talk about MEF and Prism...

No comments: