Agile Programming Practices 101 with the Nimble Pros Calendars

For the last two years, I’ve ordered the Nimble Pros Software Craftsmanship calendars, which use ‘motivational poster’ style pictures to depict various software practices and principles worth keeping in mind. Here’s one of the walls at work, where I’ve got the calendars cut up and displayed for easy reference:

DSC00646

I like being able to point to a principle when its use pops up, and they provide a nice illustration of things everyone should be aware of. I’ll be following this up with a post on each month’s topic  Smile

A Super-Fast C# Extension Method using Expression Trees to Create an instance from a Type

Having written an extension method to create an instance from a Type and been a bit underwhelmed by its performance, I looked into exactly what was happening and have now got it working much, much faster. Here's how.

Clean Code: Writing Readable Unit Tests with Domain Specific Languages

I'm currently reading Clean Code: A Handbook of Agile Software Craftsmanship by 'Uncle Bob' Martin, which includes a section on writing readable unit tests. I've had an article about using Domain Specific Languages (DSLs) to write readable unit tests in the works for a while now, and was inspired to finish it off using a 'clean' unit test from the book.

C# Performance: new vs Func vs Activator.CreateInstance()

I recently wrote an extension method which uses an Expression Tree to create a Func which creates an instance of an object from its Type. With that done I thought I'd check the performance difference between my method and Activator.CreateInstance(), which it was intended to replace. Here's what I found.

My Programming Reading List

I've made a list of programming books I've read, am reading and am going to read on the Bookshelved Wiki; would anyone like to recommend good books for a web-oriented, C# Agile programmer which I've not discovered or not considered?

A C# Extension Method using Expression Trees to Create an instance from a Type

I recently wrote a Type.GetInstance() extension method, and used the opportunity to play around with Expression Trees, which I'd recently read up on. Here's the set of extension methods I came up with, which allow you to quickly create an instance of a Type from the Type itself.

Easier ASP.NET MVC Routing

I've recently refactored the way Routes are declared in an ASP.NET MVC application I'm working on, and I wanted to share part of the system I came up with; a really easy way to declare and keep track of ASP.NET MVC Routes, which then allows you to find the name of the Route which has been selected for the current request.

Handy Generic JQuery Functions

I was a bit of a late-comer to the JQuery party, but now I've been using it for a while it's given me a host of options for adding extra flair to the client side of my applications. Here's a few generic JQuery functions I've written which can be used to add some neat little features to a page. Just call any of them from a document ready function.

A Friendlier NUnit PredicateConstraint

I've taken to using NUnit's constraint model for my unit tests, as I find it a great way to write readable tests which state exactly what they prove. NUnit has lots of built-in Constraints, but its PredicateConstraint doesn't return very helpful error messages; here's a friendlier version, which does.

Populating ASP.NET MVC ViewModels using ViewModelBuilders

The ViewModels in my current project had got quite complex; as well as properties copied from model objects, they increasingly had flags used by Views to know whether to render links or sub-sections. The logic which set these properties was bloating Controllers, so I factored it out into objects which populate all non-editable properties of a ViewModel; ViewModelBuilders. Here's how :)