Category Archives: computing

CruiseControl.NET, MSTest, NUnit: A Hybrid Solution

As many frustrated build admins know by now, Microsoft has done a poor job of distributing the proper build tools with the .NET Framework. MSBuild is in there now, but MS has failed to see the importance of including MSTest; either that, or the idea was lynched by their marketing department. This leaves us with […]

More Good Coding Practices

Don’t introduce ordering where not necessary.
Be advised of more subtleties here than are visible at first glance. Consider enumerations; an enumeration value has a name and a code. The code is redundant and is probably there for optimization purposes; as such, you should not work with it. The code associated with a value is order-dependent […]

XmlSerializer Namespaces

If you worked with NHibernate mappings, you know very well about the namespace declarations on the root element: <hibernate-mapping xmlns=”urn:nhibernate-mapping-2.2″>. We generate these mappings programmatically, and we naturally wondered how to remove the default xmlns:xsd and xmlns:xsi declarations that the XmlSerializer adds, and add the NHibernate URN in the mix. The recipe below outlines the three necessary steps.
Step […]

.NET Extension Methods How-To

I had to learn the following simple steps for making an extensions method the hard way. You don’t have to.
Procedure
To write an extension method:

Create a static class.
Write a static method taking an object of the type being extended as first parameter.
Add method parameters.
Prepend the keyword this to this this parameter.
Make the class and its extension […]

Annotations and Attributes Are Evil

Relax, relax, they aren’t evil. They’re just misused, their misuse is easily promoted, and it can even come across as appealing. Spring enables AOP through annotations, Hibernate understands metadata specified as annotations, .NET’s XML serializer allows inline attributes to specify how to serialize an object’s properties, a certain JSON library does about the same thing […]