Some features I love in VS 2010

This post will not be so long, I want to write a little about some Visual Studio 2010 features I love. First of all the changes made to C# is great, the default value on parameters rocks! When I implement Frameworks, I often ended up with something like this:

public void Log(string message)

public void Log(string message, string category)

public void Log(string message, string category, .......)

The last method is the one that have the most of the code, the other method with few parameters, only calls the last one, and pass null or an empty string as values to the extra arguments:

Log(message, null, ......)

Note: The code above is not taken from a real example, only used as pseudo code.

Now with C# 4.0, we can instead set a default value on a argument, which will get rid of the extra methods, for example:

public void Log(string message, string category = null, .....)

The dynamic feature in C# is ok, but at the moment I will not use it. When we use the dynamic when we declare a varible, it will be evaluated first at runtime. It's a nice feature when we want C# to use stuff from other dynamic languages.

dynamic something = ....

something.Hello();

 

Entity Framework 4.

Will be great now when it will support POCO (Plain old clr object):

public class Customer
{
      public string FirstName
      {
             get { ... }
             set { ... }
      }
}

There are so many other features improvements to EF, need a new blog post for that, but the POCO support and the model first approached is better supported than the first version.

ASP.NET AJAX 4.0

I love the client-side binding, I have some blog post about it, so you can read about it here:

http://weblogs.asp.net/fredriknormen/archive/2009/09/16/asp-net-ajax-4-0-preview-5-working-with-converters-and-the-new-cdn.aspx

http://weblogs.asp.net/fredriknormen/archive/2009/09/11/keep-the-first-empty-item-in-a-listbox-when-using-asp-net-ajax-4-0-preview-5-and-observer.aspx

http://weblogs.asp.net/fredriknormen/archive/2009/09/11/asp-net-ajax-4-0-preview-5-available.aspx

Silverlight designer

Visual Studio 2010 have now enabled the Silverlight designer, it was not enabled in the previous Visual Studio, so we can now easier and faster create our Silverlight apps, and no need to run Expression Blend and VS at the same time.

Improvements for web developer

Better Java-script intellisense. Easier to add Server controls to the .aspx file. Something we need to add before was the runat="seerver" attribute, it's now directly added when we add a Server control in the source mode (not talking about to drag a control, it when we write the code).

Code Contract

I like design-by-contract, think everyone should read about it. We can now use code contract in our code. What I have heard, we need the VSTS version for static checking. You can read more avout Code contract here: http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx

2 Comments

  • hum...I'm still not sold to default parameter values, though they're pretty cool for improving com interop.EF: can't look at it...probably in 2 or 3 versions. AJAX: way better in the client side, though that component model doesn't really help much. code contracts: fantastic, but only after they've solved all the existing bugs which make it unusable.

  • I'm not convinced the dynamic stuff in .NET 4 was worth the time and effort, especially since it seems to have been at the expense of many other language feature requests (see Connect).  Granted, it has been implemented in a really nice, clean and extensible way, but I don't think I'll be using it.
    Strong typing and stricter validation through code contracts is definitely the direction things are heading, so I'd rather MSFT concentrated on that side of things.

Comments have been disabled for this content.