PDC has begun!
The keynote was started and ended by Ray Ozzie, with other supporting cast in between. The major thing coming out of the keynote was the cloud services based on Windows Azure (pronounced by most “Ajoor” with a French style J (like “bonjour”), but some other MS guy called it “azoor”). This is the operating system of the cloud, that was designed by two guys, one of which is Dave Cutler, the designer of Windows NT (and previously VMS). Cloud services are built on top of Windows Azure and deployed very easily to the cloud, where Microsoft’ servers and Windows Azure take care of scalability, load balancing, availability, etc., freeing the developer and the company from those burdens. Definitely a good idea for most people. Prices will be competitive, promised Ray Ozzie. The above link has the SDK (in a CTP release) and VS tools that you can download now.
Session 1
After the keynote, the first session I attended was titled “Advances in the .NET type system”, which was to tell something on the improvements in the type system for CLR 4.0 and .NET 4.0. It turns out that 2 main features were discussed, that arouse from the issue of carrying large COM interop assemblies when the app needs only a few interfaces and classes, a typical scenario when doing interop with Office applications.
When you interop with Excel or Word, for example, you must use the Primary Interop Assembly (PIA) of Office, thus increasing your code base by as much as 6.3 MB (for Office 2007). This is clearly undesirable as you might only want to use a few interfaces, so don’t need so many RCWs. The new /link switch to the C# compiler lets the compiler import types from the interop assembly and create local types (interfaces) with the same methods as are used. Unused methods are filled by dummy entries to preserve the Vtable method order. This eliminates completely the need for the interop assembly – very cool idea, and, admittedly – long time coming. The next part dealt with type equivalence between the local imported types and the original ones. The CLR is smart enough to treat them as one and the same if their GUIDs match.
The presenter was pretty bad, but the ideas were good. For the non-interop scenarios, interfaces and simple structs can be imported as local types, but must be “decorated” as COM entities by adding GUIDs and [ComImport], etc. Questions from the audience regarding security arose, as one could write a compatible interface and use it in place of the real one. The presenter and his aids had no good response, apart from “this requires full trust”, and they are still debating this…
Session 2
The next session I went to after lunch was “the future of C#” by Andres Heljberg, the language’s creator. His presentations are always fun, funny, and very informative. This was no different. He outlined some of the ideas leading to C# 3 and then described the new C# 4 features and even gave a small demo of C# 5 features further ahead.
The good features of C# 4 are default values and named parameters (a-la VB.NET). Finally, C# has it too.
Another feature concerns co-variance and contra-variance of collections and arrays (interfaces and delegates only). This allows, for example, to pass a string array as IEnumerable<object>, something that the C# compiler can’t accept today. I will probably address this feature in a future post more thoroughly.
The most controversial and interesting new feature was the possibility of calling dynamic code directly from C#, including calling COM code, IronPython (and other dynamic languages) and even JavaScript from C# directly, without any “glue” code.
Here’s a simple example. If I have an object reference and I want to call the foo method on it (assuming I know there is such a method), how would I do it? Today, I can do this with reflection, but this is definitely not natural:
void CallIt(object o) {
o.GetType().InvokeMember(“foo”, …, o, new object[] { “hello” });
}
Some enum values are missing in the above snippet, but you get the idea. In C# 4 I can write:
void CallIt(dynamic o) {
o.foo(“hello”);
}
A new keyword, dynamic, is introduced, that basically means “object” but the type is dynamic, that is, a binder must be used to translate the above code at runtime (or throw an exception) and call the method. Again, I’ll probably do a separate post on that.
The direction C# 4 and beyond goes, seems to be gaining dynamic language capabilities. This was somewhat frightening, as it seems C# 5 can do what Javascript can do (e.g. create properties and methods dynamically). How these features will be used or abused still remains to be seen.
Session 3
The next session I attended was on dynamic languages. This was a good session, talking about the DLR, and some of its features and how they are implemented. It was somewhat connected to the C# talk, as a trend is building to unify the static and dynamic languages, or at least to make them very good friends. I’ll probably tackle this issue in a future post as well (so many posts are building up).
Session 4
The last session I attended was on building and deploying a cloud service. The presenter, Steve Marx, did a fairly good job of demonstrating some of the capabilities of services running in the cloud. Although the session was more complicated than it should have, as he used the MVC framework and not traditional ASP.NET, that may have distracted some of the attention from the real issues. Clearly, he likes MVC.
Summary
All in all, it was a mixed day, with a mediocre keynote, one really bad presenter, but the day improved after lunch, although some of the new C# features are somewhat alarming, as static typing seems to be a bit neglected in favor of inserting dynamic types support.
Until tomorrow!