Feeds:
Posts
Comments

Archive for the ‘Design Patterns’ Category

Please first read Part one of the simple producer – consumer queue in .net4. In part 1 we defined a standard producer – consumer queue, however, there was nothing that particularly made this stand out from a queue written in a previous version of .Net. In this post, I am going to upgrade the queue [...]

Read Full Post »

It might seem a strange thing to do. Firstly can there be managed memory leakage? And secondly how can you unit test for this? I’ll put this into context and then all will become clear. I came across this interesting problem recently when playing around with a set of streaming real time data and attaching [...]

Read Full Post »

In my recent post introducing the news aggregator I detailed what we are currently building. In this post, I will discuss some very high level architecture and some considerations around how to build the application. My first draft at architecture is to just get the different functional parts of the program identified. Then later we [...]

Read Full Post »

When binding data to WPF controls it is good practice to use a IValueConverter or IMultiValueConverter or use the adaptor pattern which is what I do for the equivalent when using MVC for the web, to change the values from your domain objects to something you can bind to which makes sense for the Gui [...]

Read Full Post »

Over the years I have changed the style of my HTML coding considerably. Back in the day (pre 2000) every one including me coded everything using tables. Tables rocked and made it quickly possible to layout pages. Pages were mostly cut up images straight from Photoshop. It was the web developer’s job to create a [...]

Read Full Post »

I recently wrote a post about how to set up CW’s IOC container for applications. This post covered the most basic implementation to get an IOC container up and running. It is now time to cover a proper architecture for using IOC specifically for web applications / sites. The main problem with the previous implementation [...]

Read Full Post »

Testing Microsoft’s web forms (asp.net) UI. Microsoft’s web form architecture is not particularly good for testing. The event driven architecture of ‘code behind’ means lots of logic gets stored in C# code that is tightly bound to the HTML code. This means you can’t write purely C# unit tests for it. The best solution is [...]

Read Full Post »

Whilst developing applications and especially while unit testing it is often required to test whether an object t is equal to some other object of the same type. It is almost always a value type comparison that is required. This means we need to check to see if the fields on the objects match and [...]

Read Full Post »

I had an interview the other day and thought I would write abut one of the questions I had. It involved releasing references to COM objects in .NET. The pattern to do this is unsurprisingly called the Dispose pattern. The problems with using COM components in managed code are as follows: 1. Developers can accidentally [...]

Read Full Post »

This is the second in the series of design patterns. The first post might have been a little verbose so I thought I’d liven this one up a bit with a good old fashioned class diagram and some actual code! I used the decorator pattern recently on the advert booking project. The scenario is this: [...]

Read Full Post »

Older Posts »

Follow

Get every new post delivered to your Inbox.