# Thursday, November 09, 2006

First session this morning was C# 3.0 with Anders Hejlsberg. Basically the talk revolved around the features they've added to the language in order to enable LINQ which I talked about yesterday.

Type inference

  • A new keyword called var
  • Type is inferred from the right side of the expression: var customer = new Customer(); var = 10;

Anonymous Types

  • Creates a new type based on the data projected to it
  • Unspeakable types, only works with the var keyword

Extension methods

  • A way of extension existing objects with static methods
  • You could for example add a new methods to object and have it available on every single object in your application

Lambda expressions

  • Nice way of avoid having to create delegates and passing those to a method

Variable initializers

  • Customer c = new Customer() { Name = "Søren", Age = 28 };

Automatic Properties

  • Not yet included in CTP
  • string Name { get; set; }
  • Need to have both getter and setter.
  • Readonly possible by using { get; private set; }

Expression Tree

  • Data represenation of a query instead of IL
  • Better at showing intent than IL

LINQ

Also we got a few tidbits about where the language will go after the Orcas release. Of course he couldn't commit to anything but he did mention a couple of areas they're looking at: Dynamic languages and multi-threaded programming. They are keenly aware of the fact that people have regained interest in dynamic languages and so they are thinking about how to go about incorporating dynamic-like features into the language. Anders mentioned that he would try to adhere to a static typed environment where you don't need to specify type but the types are still there for the compiler to use while checking code at compile time and to do various refactorings more effective. It's good to hear that Anders is sticking up for the strongly typed environment.

My two cents on the matter are that while dynamic languages are great and very RADy, the argument that they are more viable today due to the fact that more unit testing occurs I just don't buy. Yes unit testing has become more prevalent but the fact of the matter is that you simply cannot do 100% code coverage when you need to get a product out the door. You'd basically need 100% code coverage in order assure the same levels of quality if you don't have the compiler to catch stupid code errors like type mismatches and that stuff. We as developers are lazy, we don't always get around to doing all the necessary unit tests, it sad but it's fact and so stupid errors will start to occur in our code.

I couldn't get an answer to my Orcas timeframe question yesterday but today Anders did mention that we are looking at maybe a year, maybe more, maybe a bit less to use his own words. Nice to have some idea of when we can expect all the new stuff in final form. Of course much of what is being demoed here is available in CTP form.

Comments are closed.