Archive for January, 2011

South Florida Code Camp. Feb 12th 2011

Hello everyone!

I will be attending the South Florida Code Camp on February 12th 2011!  I am going to be speaking on my asynchronous topic showing the different techniques we have used for asynchronous programming and how they evolved, and finally we will be looking at how Microsoft straightens out asynchronous programming with the new Visual Studio Async CTP.  The samples revolve making asynchronous calls to WCF in WPF and Silverlight applications (which turns out to be one of the most common client uses for asynchronous programming).

For more information please visit

I hope to see you there and have a good day!

No Comments

Asynchronous Programming Now and in the Future

Hello everyone!

I recently spoke at an MSDN geekSpeak on Asynchronous Programming techniques and how they have evolved over time.  I wanted to give just the highlights of the different techniques and post the code.  So here is a list of the different techniques I showed around making WCF calls in WPF and Silverlight asynchronously and some pros and cons about them!

  1. Event based – This technique was probably one of the first ways to write code that can be notified when an asynchronous process is complete.  This technique helped in that it was a solution to the problem, but the code can be very disjointed and hard to read.  Sometimes you only ever want to be notified through one chain of operations but with eventing it reads like it could happen multiple times
  2. Lambda Callbacks – Lambdas definitely helped to make the code more readable and took away the need for cleaner management of events.  We still have certain ways we have to execute our operations and are never guaranteed that code will fire in order so we have to work around it.  However this was a very big step towards making asynchronous coding more manageable and readable.
  3. WorkerQueue – A friend and co-worker of mine Nathan Allen wrote a tool that takes the idea of lambdas and really organizes the underlying processes to make it even easier to manage code.  With the WorkerQueue you actually write synchronous code but you choose which lines you want to execute on a background thread versus lines you want to push to the ui thread and wait for them.  This helps us to write synchronous code while still yielding the ui thread so we don’t lock up on longer running processes.  You can get the code for this tool on his blog here.
  4. Visual Studio Async CTP (await/async) – With the new Visual Studio Async CTP Microsoft has really “straightened” out asynchronous programming by abstracting the complexity with threading and the like.  With this new concept you truly write synchronous code without hardly any extra effort.  In fact when you write code like this you can almost completely write in the way that synchronous code is written with a few extra keywords.  Basically this implements some compiler sugar that for an async/await method creates a little mini state-machine.  It will execute the lines until it hits an await then executes that on a Task, when the Task is completed it updates the state and executes the next step of the state machine.  This is definitely my favorite technique next to using the WorkerQueue and I am eagerly awaiting the release of this extension.

I have posted the code samples here.  You will probably need to install the Visual Studio Async CTP and you can get it and more information here.  I don’t believe that this changes any core .net, just the compiler and visual studio.

I will be speaking on this topic at various events and will post each event I am speaking at on my blog.  If you are in the area and would like to learn more about asynchronous programming then please come!

I hope you enjoy this and happy coding!


MSDN geekSpeak Asynchronous Programming Now and in the Future. January 12th 2011

Hello everyone!

On January 12th 2011 at 3:00 PM EST, Glen Gordon Peter Laudati and I will be doing an MSDN geekSpeak event on Asynchronous programming techniques.  We will cover a lot of different ways to write asynchronous code using the example of a smart client mentality (WPF or Silverlight) around WCF services.

While these techniques are not specific to calling WCF service and can be used for other mentalities like offloading long-running ui processes, this is a very common scenario for WPF and Silverlight applications and can help developers decide how to write their code.  We will be covering Synchronous programming, Event Based programming, Lambda Callback based programming, Worker Queue based programming and finally the new Visual Studio Async CTP (await/async) programming style.

You can view the MSDN geekSpeak blog entry with more details and the registration link to sign up here.

I hope to see y’all there and happy coding!