Misapplied "Premature Optimization"

First of all, let’s get some definitions out of the way. Optimisation“…the process of modifying a system to make some aspect of it work more efficiently or use fewer resources.” 1 Premature Optimisation“Optimization on the basis of insufficient information.” 2 In other words, premature optimisation is making a modification to some aspect of a system without sufficient information to gauge whether it will make the system more efficient or use fewer resources. The key point I’m emphasising is “modification”.  Other’s have blogged about this in the past; but I still see far too often that “Premature Optimisation” is used as … Continue reading Misapplied "Premature Optimization"

New Contributor to the C# Developer Centre

A new contributor to the C# Developer Centre has posted a new article.  This article goes into great detail about extension methods, what they are and how they’re implemented.  If you’re more than curious about this feature of the soon-to-be-release Visual Studio 2008 and C# 3.0, it’s a great read.  http://msdn2.microsoft.com/en-ca/vcsharp/bb905825.aspx

Using Exceptions For Normal Logic Flow

The generally accepted wisdom is that you shouldn’t use Exceptions for normal logic flow.  Normal logic flow is a bit subjective; but anything that must happen at least once in all known scenarios is normal logic flow. Enter XML Serialization in the framework.  The framework actually dynamically creates types that perform the actual serialization of a given type and caches that assembly.  The next time that type needs to be serialized it reuses that generated type, reflection is minimized and things happen pretty quickly. Here’s the rub.  The framework decides that it must generate the type when Assembly.Load generates an … Continue reading Using Exceptions For Normal Logic Flow

Who’s Referencing Whom?

When developing any sort of application, debugging in inevitable.  Sometimes, part of that debugging means trying to figure out why objects haven’t been collected and therefore figuring out what object is referencing the object that has yet to be collected. There’s many reasons why you’d want to find out what object is referencing, like suspected memory “leaks”. With Visual Studio (and MDbg) you can use a tool called SOS (or Son Of Strike).  This is included in the .NET installation.  To use SOS you first need to enable unmanaged debugging in your project (Project\Properties, Debug tab, check “Enable unmanaged code debugging” in … Continue reading Who’s Referencing Whom?