.NET 4, do you know the new features? - Introduction

Submitted by Robert MacLean on Mon, 09/05/2011 - 09:27

imageAs part of my work ahead of Microsoft Tech·Ed Africa 2011 I did a online, anonymous poll to see how well known are the new features in .NET 4, and over the next few days I thought I would share my findings.

The poll asked you to state for feature X: Do you know it? And if you do know it, is it a useful feature?

I listed 61 features that are new in .NET 4 – which pretty much covered the length and breadth of it. There is some consolidation, like ALL of Workflow is one item but WF4 is a rewrite so pretty much is one BIG new feature and some other aspects of consolidation.

I suspected a fairly high rate of known features because .NET 4 was released 16 months ago (12 April 2010) and it has been demo’d and talked about a lot - even I have done a talks on the new features. However the ratio of unknown to known is 1.2 : 1 – so while there is a close parity, there are more are unknown than known, which surprised me a bit.

I have broken up talking about the results into a series, because I want to talk about each feature briefly so a single post would have been MASSIVE.

Below are links to the other parts of the series:

Finally I want to say a BIG thanks to everyone who answered and those who shared links on social networks and with friends!

The raw data can be found below.

Lightswitch is on SALE!

Submitted by Robert MacLean on Fri, 09/02/2011 - 11:23

Nurt img1Very different from my normal ramblings but I thought worth a quick post, Microsoft has Lightswitch on sale at the moment for 33% off the price! This is a world wide offer so you can get it via your distributors, LARS or from the Microsoft Online Store.

So if you are looking to get started in Lightswitch, NOW IS THE TIME!

OLE DB is dead, long live ODBC

Submitted by Robert MacLean on Tue, 08/30/2011 - 09:36

imageMicrosoft has announced that OLE DB with regards to SQL Server has entered the end of it's life - it has about 7 or 8 years left and "Denali", the next version of SQL Server, will be the last version to support it. The recommendation is to use ODBC going forward.

The reasoning is pretty sound to me:

  1. Better cross platform support - yip Microsoft cares about cross platform.
  2. Better clound support - No surprise that Microsoft cares about the cloud.
  3. I am also assuming that budget is part of this, providing OLE DB & ODBC is two dev teams, two test suites etc… Just doesn’t make sense. Rather consolidate and spend the savings elsewhere.

It is important to note that other OLE DB providers and OLE DB itself are still continuing, we are just talking about SQL Server.

Have a look at the picture to the right only two out of the seven are affected by this announcement, that means there is still a big investment in it and I doubt we we will see OLE DB going away completely anytime soon.

Microsoft has produced a helpful guide to migrating which you can get below.

Nugget: String concatenation compiler optimisation

Submitted by Robert MacLean on Mon, 08/29/2011 - 11:49

William Brander responded to my last nugget on compiler optimisation with a tweet about another one:


So what does that look like? Let’s look at the code we type:

string interesting = "first";
interesting += " second";
interesting += " third" + " forth";
interesting = interesting + " fifth";
interesting = interesting + " sixth" + " seventh";

And this optimises the concatenation to a single line and drops the variable. Interesting use of braces for fifth & sixth though, when I switched += to =.


Console.WriteLine(("first" + " second" + " third forth") + " fifth" + " sixth seventh");

Windows Phone 7: Professional Tips - Always show the SystemTray

Submitted by Robert MacLean on Mon, 08/29/2011 - 11:47

imageIn Windows Phone 7 there is an option to show a little strip at the top of your application which shows time, battery and signal strength. This is called the SystemTray.

My suggestion for a professional applications, is that you should be showing that SystemTray. Full screen games & media viewing excluded, but most tool like applications should be showing it.

My reasoning is two fold:

  1. If you user is spending any time in your application they may need to check their battery or  they will need to check the time. Having it available keeps them in your application and keeps them from being frustrated by the toggling backwards and forwards (glance and go!).
  2. If you application connects to the internet, and you fail to connect you are required to tell the user that it failed. For me internet connection failures are often due to signal or due to being connected to a hotspot. If it fails and I do not have a SystemTray, then I need to leave the application to check those details. Once again, the glance and go principal!

It takes up a few pixel’s but your users will be happier for it being there!

App.Config Transformations: The community shines where Microsoft drops the ball

Submitted by Robert MacLean on Fri, 08/26/2011 - 08:03

Last year May, I spoke at DevDays Durban about what is new in ASP.NET 4? One of the highlights of that talk is a feature called Web.Config transforms. In short you have a base web.config and then a file per compiler target (i.e. RELEASE, DEBUG). These extra files contain rules on how to transform your web.config when it is published.

In a way of an example you have might your web.config to use your local SQL Server when in Visual Studio, but when you publish a DEBUG build to testing it changes the config to use the test SQL Server. Or when you publish to production it turns off a bunch of logging and shows friendly error messages.


There is TWO caveats in this process:

  1. ONLY works for ASP.NET* projects as this is something the ASP.NET team built into their publishing tool support.
  2. ONLY works for publish, if you have an ASP.NET* project and hit F5, nothing happens Sad smile

*ASP.NET = ASP.NET Core, and thus systems that build on top of it (WebForms, MVC & WebPages) all get it.

This is something we need in EVERY project type and we need with F5. Thankfully some bright people did just that for us, with the VS add-in Slow Cheetah.

So now you get the full experience on any project type, PLUS you get a brilliant feature missing in the ASP.NET one – PREVIEW. You can see what the resulting config will look like!

Windows Phone 7: Professional Tips - Drop the splash screen

Submitted by Robert MacLean on Thu, 08/25/2011 - 11:33

The guidelines for WP7 state your application must start within 3 seconds – so many applications include a splash screen to show the user while the rest of the application loads. The splash screen is included by default so you may think you MUST to include it (I did think this too), but the truth is you don’t need to.

If you can (i.e. your application loads under 3 seconds) then you should drop it as it will allow your application to start quicker (about 2 seconds faster in fact), this means your users can get into your application quicker and that will make them happier!

Windows Phone 7: Professional Tips - Storing your settings

Submitted by Robert MacLean on Wed, 08/24/2011 - 11:00

In Windows Phone 7 there are two ways to store values State & IsolatedStorageSettings which have their various pro’s and con’s. I prefer to use the IsolatedStorageSettings for most scenarios but this tip will apply to both, so when you see the code referring to one it will work on both.

Very simply the first setting you should store is one called version (or similar) and should have a version indicator. In short it tells you what version of the settings you are working with!

IsolatedStorageSettings.ApplicationSettings["version"] = "1";

Having this field has two advantages for you, first it gives you a very simple way to check if you have settings available & if it is not, then your app is running for the first time.:

if (IsolatedStorageSettings.ApplicationSettings.Contains("version"))
    // do something with settings

The other advantage is that when you update your application you can upgrade settings easily. 

if (IsolatedStorageSettings.ApplicationSettings.Contains("version"))
    switch ((int)IsolatedStorageSettings.ApplicationSettings["version"])
        case 1:
            // upgrade version setting and add missing settings or change existing settings
        case 2:
            // normal reading of settings
Even if you never use it for upgrades, at least it is there for a simple check and if one day you need it - you are ready to go!

Game development in South Africa and dealing with the Film and Publications Board

Submitted by Robert MacLean on Mon, 08/22/2011 - 16:03

imageIf you walk into any store to buy a game or movie you will find a little blue triangle sticker which contains the age restriction from the Film and Publications Board who review and rate content.

Since I created a game recently I decided to see what the process is for classification of a game is and learnt some very interesting things for developers.

Put simply only games/films that are sold or hired require to be classified – so if you are developing a game/films that will be available for FREE then you do not require classification! Below is the email from the head of the classification unit confirming that!


GREAT NEWS for hobbyist developers!

If you do plan to sell your game then you need to complete the forms on the website (game submission form), provide a disc with screenshots and videos of your game, a game synopsis and pay the registration fee (currently R1 508.64) and then wait for the classification.

Microsoft have confirmed & I have tested that the forced requirement for the FPB certification in the marketplace no longer exists. You can submit a certification but you are not forced to. Only downside at the moment is Window Phone 7 – when you submit a game for the South African market regardless of price they require the certification which is incorrect. I have submitted a request to Microsoft for details on this and will update you as soon as I have any information.

Community night in September 2011 - IMPORTANT INFO

Submitted by Robert MacLean on Mon, 08/22/2011 - 10:26

Community Night, the best way to meet, mingle and learn (if you don’t know about it – read here) happens on the second Tuesday of the month… except in September due to an event at the venue on the Tuesday which can’t be moved.

So for September it will take place the Monday before, in other words Monday the 12th September. Please help get the word out to the various user groups and communities!

See you there!