A Upcoming Pandemic of Domain Anaemia

There’s a well-known anti-pattern called the anaemic domain model[1][2].  This anti-pattern basically says domain entities, chronically, have little or no behaviour (remember, object-oriented design is about attributes and behaviour). It should be obvious that a domain model that isn’t truly object oriented is a domain model with a problem.  But, let’s look at other reasons why the Anaemic Domain Model is an anti-pattern.  Your Domain is the nexus, the essence, of your system. An anaemic domain model is basically a reporting system.  Each “Entity” becomes, essentially, a query.  This is fine, reporting systems are necessary and prevalent.  But, to shoe-horn … Continue reading A Upcoming Pandemic of Domain Anaemia

Bugs Are Features Too

It’s surprising how many bugs on Microsoft Connect are closed as Won’t Fix with a reason that fixing the bug would be a breaking change. The logic is that someone could be dependant on the errant behaviour and thus changing it would cause their code to break. Here’s some samples. TypeConverter.IsValid(Object).  This method is described as “Returns whether the given value is valid for this type”.  But, this results in true:             TypeConverter typeConverter = TypeDescriptor.GetConverter(typeof(int));             Console.WriteLine(typeConverter.IsValid(“ten”)); Based on the description of IsValid that this is what was intended:              Debug.Assert(false == typeConverter.IsValid(“ten”), … Continue reading Bugs Are Features Too

Entity Framework Petition of Vote of Non Confidence

I had intended to be happy simply being a signatory of ADO .NET Entity Framework Vote of No Confidence.  But, there’s people suggesting signatories of this petition are wackos or on the fringe. Do yourself a favour and read the petition.  Read what we have issues with and how we think Entity Framework (EF) can be improved to be a better product.  Read seminal material by industry leaders on entity-oriented and object-oriented application development like Domain Driven Design, and Agile Principles, Patterns and Practices in C# (and the predecessor Agile Software Development: Principles, Patterns and Practices) and Applying Domain-Driven Design and … Continue reading Entity Framework Petition of Vote of Non Confidence

Spaces or Tabs?

In this day and age it seems silly to get into a discussion about whether your companies coding guidelines should have a section mandating either spaces or tabs for indents.  Tabs are clearly more flexible, but I really don’t think it matters at all; people can easily read code that contains spaces or tabs. But, Microsoft has departed from what seems to be the rest of the world and is mandating spaces in their new Microsoft Source Analysis Tool for C#. Word is that an update will not only mandate spaces but mandate 4 for indents. Again, I don’t think … Continue reading Spaces or Tabs?

System.Collections classes are obsolete

Collection classes like ArrayList, SortedList, Stack and Hashtable will shortly be obsoleted (i.e. the ObsoleteAttribute will be applied to them in upcoming .NET Framework builds).  You can start to see this in the Silverlight Alpha (i.e. the Obsolete attribute), but they will be physically unavailable in the release version. More details can be found in a recent Base Class Library Team blog entry Non-Generic Collections to be Removed from Silverlight. Even if you don’t plan on writing Silverlight-compatible code you should avoid using the types detailed in the BCL Teams blog because they’ll be obsolete in other future versions of … Continue reading System.Collections classes are obsolete

DateTime.ToUniversalTime *Should* Throw Exceptinos.

A recent .NET Base Class Library blog post points out that DateTime.ToUniversalTime does not throw an exception for overflow values. This circumvents different Microsoft-sanctioned guidelines about using exceptions for exceptional situations, error reporting guidelines, not using return codes to communicate errors (which essentially what this is), the Method/TryMethod pattern, allowing the error to propagate to a level that knows how to deal with it, etc. I would recommend having overflows handled as exceptions and the addition of a TryToUniversalTime.  If the Method/TryMethod pattern is the favoured approach to providing two methods that result in the same thing–one without exceptions–this is impossible … Continue reading DateTime.ToUniversalTime *Should* Throw Exceptinos.

Microsoft Open Source Lab

After the the Microsoft MVP Global Summit, I got a chance to meet with Sara Ford where she gave me a wonderful tour of campus.  Part of that tour was an introduction to some of the folks at port25.com and a look at the open source lab.  The port 25 folks are busy building an impressive set of servers (blades, HPC, etc) running various OSes (like many distributions of Linux and Unix, Windows Server, Compute Cluster Server, etc.) performing various tasks like interoperability tests and codeplex.com tasks.  I can’t do the complexity of their installation justice–a more detailed description can be … Continue reading Microsoft Open Source Lab