Command Handlers

The command pattern is one of the patterns defined in the gang of four's behavioural patterns but I rarely see it get much use. The idea behind the pattern is to encapsulate all of the information required to execute an action within a single object or class: public interface ICommand…

Read this article

Have we forgotten what constructors are for?

Bit of a sensational title there, but I do think it's true. Believe it or not constructors are not just for injecting dependencies into a Controller or a Service. They actually serve another purpose as well. Making sure that we can't construct an object in an invalid state. I often…

Read this article

Time to cast away Visual Studio and use a text editor

I've been working on an OSS project for the past couple of weeks that I'm really excited about. It's a project that is going to allow you to effectively write .Net code outside of Visual Studio and it's called Omnisharp. To give a little bit of background It all started…

Read this article

Passing an object to a generic method

There's nothing complicated about this. But for some reason the solution escaped me. You know how it is. You have an idea in your mind and it just gets more and more complicated. Then somebody comes along and shows you something really simple. So you may know how to do…

Read this article

Entities should look after their own events

I've been playing with CQRS and ES a lot recently and to be fair I should have started blogging about my experiences before now. But better late than never. This week I've been looking more carefully at how to manage the events that get applied to an entity within my…

Read this article

This Code is Bad and you should feel Bad

Want to mark some code as bad in your code base? Somebody written some poor code and you want to point it out? Need to mark some code to be reviewed? Well this is the attribute for you! [AttributeUsage(System.AttributeTargets.All, AllowMultiple = true, Inherited = true)] public class ಠ_ಠAttribute…

Read this article

ASP.NET you're doing it wrong. Part Two: The Views

In my previous post I spoke briefly about how to setup routes and handle route arguments etc. In this post I'm going to run through the various options you have for returning and presenting your data in views. If you haven't already I suggest you read the first part of…

Read this article

Why I'm no longer giving up on C#

For while now I've been getting bored and annoyed with C#. Its not that its a bad language, its just that when you look around the web there seems so many other languages that seem so fluent to write. NodeJs, Ruby, Javascript, Cloujure. These languages are all the rage at…

Read this article

Saving Key Strokes can bring a World of Pain

Developers seem to fall into two schools of thought on this one. Limit the amount of code you write or leverage the syntax to assure no mistakes are made. I've flirted between the two, but right now I'm heavily in favor of the latter approach. What am I talking about?…

Read this article

403 Error and .NET Bundling

Came across this one the other day whilst using the .NET bundling functionality. All was fine in debug mode but as soon as I pushed it to production everything went pear shaped. The combined file kept returning a 403 error. After a bit of prodding around it turned out the…

Read this article