September, 2009

The Art of Unit Testing

It appears there are those who think it's perfectly Ok to steal Roy Osherove's latest book, "The Art of Unit Testing".

Seems a bit rich to me - after three years of hard work, surely Roy deserves the small recompense he gets for each copy sold.

I wonder how many of those who cheerfully stole his work would be just as happy to have three years of their hard work stolen by people too lazy or too cheap to pay.

Review of TechEd New Zealand 2009

I've written up a review of TechEd 2009, covering many of the sessions I attended an my thoughts on each. It's necessarily brief, but I hope you'll find it informative.

Co- and Contra-Variance in .NET 3.5

A lot of the discussion about .NET 4.0 is revolving around the introduction of co-variance and contra-variance for generic types.

It's important to remember, though, that these concepts aren't entirely new - there has been some support for variance built into .NET for some time.

For example, consider this snippet of code:

    public Form1()
    {
        InitializeComponent();
 
        textBox1.KeyPress += Handler;
        button1.Click += Handler;
 
        textBox1.KeyPress += new KeyPressEventHandler(Handler);
        button1.Click += new EventHandler(Handler);

Coming up to speed

Over on Five Whys Roy Osherove has an interesting post on how to find the hidden problems on your project.

Assuming you're a new tech lead on a team, and everyone else is already up to speed, how do you find out the problem areas?

Roy suggests you get everyone together - including the stakeholders who stand to benefit (or be crucified) and ask one simple question:

TechEd New Zealand next week

Looking forward to attending TechEd next week - a chance to see some of the new stuff and to learn a bunch.

Hopefully there'll be a lot that I haven't heard of, but I suspect only snippets will be truly new. Stay tuned - I'm intending to blog my thoughts on a few sessions.

Oh, and #tenz9 for the search engines. ;-)

Testing and Static Methods

I'm working with a large codebase at the moment, trying to write unit tests to ensure that the changes I'm making aren't compromising the existing code.

For some of the code, this is easy. For other pieces, not so much.

One area that I'm finding difficult is in the area of static methods. Historically, I've been a fan of static methods for some scenarios. But, now I'm finding them a bit of a pain.

Linq vs Loop performance

The StackOverflow question Convince me to move to .net 3.5 (from 2.0) piqued my curiosity when against one answer the commenter wrote:

This does come at a cost tho: ox.no/posts/linq-vs-loop-a-performance-test/…

I followed the link to find out, and found a benchmark that is, in my opinion, flawed.

Why?