Monthly Archives: December 2004


Just to prove that I am a true geek I thought I would tackle Brad Abrams latest C# quiz. The simple answer is that it won’t compile because the Thread classes constructor can now take two different delegates, ThreadStart, and ParameterizedThreadStart, and because the code uses anonymous methods – the compiler can’t figure out which delegate you mean – its ambiguious, you’ve just got to love the compiler error though.

“ Error 1  The call is ambiguous between the following methods or properties: ‘System.Threading.Thread.Thread(System.Threading.ThreadStart)’ and ‘System.Threading.Thread.Thread(System.Threading.ParameterizedThreadStart)’”

There are a couple of ways that you can change the code to solve the problem:

  • new Thread(delegate() { Console.WriteLine(“On another thread”); }).Start();
  • new Thread(new ThreadStart(delegate { Console.WriteLine(“On another thread”); })).Start();
  • new Thread(delegate(object foo) { Console.WriteLine(“On another thread”); }).Start();
  • new Thread(new ParameterizedThreadStart(delegate { Console.WriteLine(“On another thread”); })).Start();

There are four options because there are two different delegates, and two different ways to create them without ambiguity. But hang on a sec – Brad listed FIVE solutions, and more than one of them is different to mine. Sure Brad – you go right ahead and declare another explaining variable – you hippie! 😛

The fifth one was interesting though, and I think it was supposed to be a hook that brought up some discussion, there are two to be had.

  1. When are anonymous methods good, when are they bad?
  2. How cool is new kid on the block, ParameterizedThreadStart?

I think the jury is still out on number one, but I have seen some interesting usages. However, I do have an opinion on ParameterizedThreadStart. The framework needs this, especially if you want to quickly dispatch a method on another thread with some reference data without using up a thread on the system thread pool, however I’m not going to be so quick to give up the job dispatch patterns just yet – why? Telemetry in a multi-threaded environment.

When you build an abstraction over multi-threading libraries you can allow the code executing on those threads to publish information out about their progress and activities. It also helps highlight code that operates in a multi-threaded environment because you slap them into some kind of job class.

Earthquake Kills 10,020

There was an 8.5 earthquake last night with an epi centre near Banda Aceh in Sumatra (BBC News Coverage). Because of the locations proximity to water it caused a massive Tsunami (Wikipedia Coverage).

The areas affected include Indonesia (Sumatra is part of Indonesia), Sri Lanka, India, Thailand, Malaysia, Maldives and Bangladesh. Sri Lanka, Indonesia and India were hardest hit with 3538, 4185 and 2000 respectively.

Update #1: The death toll has now risen to 22,000 (Source:, AP). From the article it says that the waves created raced across the 2,800 miles of the Indian Ocean and hit Africa. So the already suffering citizens of those regions have been dealt a double blow. With so many impacted I wonder what can be done to help.

How much is an idea worth?

Sounds like a bit of a dot-com question doesn’t it? But its something that has been on my mind lately because I have some business ideas based around technology that I want to work on, but unfortunately I don’t have the capital to execute. So, if I was to work with a VC how much would my idea be worth if they put up the cash?

News of Avalon’s Demise is Greatly Exagerated

If you have been watching the blogosphere lately you would have heard about the Apache Software Foundation pulling the plug on an umbrella project called Avalon. This may have caused some confusion amongst the .NET developer community where Avalon is the code name for a new graphics and UI construction stack.

Avalon (Java) is (was) a set of frameworks supporting IoC. I’m not going to talk about them directly here, but I do want to reflect on one of the advantages of not having a 5,000 pound gorilla IDE which dominates the developer landscape – that is it frees people up to explore these code intensive frameworks because the expectation of productivity increases via some kind of designer support is pretty low.

I’d love to try some of these things in future projects (ports to .NET that is) but have trouble swallowing the pill. Of course I wouldn’t even consider it if the ServiceLocater pattern that is implemented across the framework wasn’t also broken (try doing IoC in a Windows Forms app at runtime and tell me how far you get before you start resorting to hacks).

Hopefully this will be something that is fixed in Avalon (from Microsoft) . . .