Preventing dependency version conflicts in .Net libraries

What is the issue? Dependency version conflicts happen when you have multiple libraries referencing the same dependency, but with different version numbers. This is in fact quite common, so much so that Microsoft has done a lot to try and automatically resolve the issue. You might even be affected by it without knowing. The way […]

Read More »

C# based simple service locator

I’ve always loved the Service locator pattern – why ? Because it requires so little maintenance, and it’s a very crucial point if you want somewhat automatic dependency injection.

As you can read in my blog post “Staying DRY: Mind those switch statements” a service locator can replace cumbersome multiple switch statements which require each one to be changed whenever a new case comes along.

Read More »

SOLID principles – Part 4: Interface Segregation Principle

This is the fourth of a five part series, where I go over the 5 principles which make up the SOLID principles by Robert C. Martin.

The fourth one is I: Interface Segregation Principle (ISP)

This principle states that interfaces should only contain the absolutely required properties/methods needed.
If an interface contains properties/methods the client code does not need, it should be split into more smaller interfaces.

Read More »

SOLID principles – Part 3: Liskov’s Substitution Principle

This is the third of a five part series, where I go over the 5 principles which make up the SOLID principles by Robert C. Martin.

The third one is L: Liskov’s Substitution Principle (LSP)

This principle states that if S is a subtype of T, then objects of type T may be replaced with objects of type S without altering the desirable properties of the program (includes correctness, task performed, etc.)

Read More »

Staying DRY: Mind those switch statements

As a developer you probably know the DRY abbreviation already: Dont Repeat Yourself.
This is one of the better known principles, and it’s fairly easy to comprehend too: Don’t implement the same logic twice.

However one place where most people slip with DRY, is the switch statement.

Read More »

Thread signaling simplified

When using multiple threads in an application, you often want to be able to signal threads, to ensure a high level of responsiveness.

There are multiple ways to do this, but here’s what I feel is the best solution.

Read More »

Recommended reading

I often come across some good articles, so I decided to start sharing them.
This time I’ve got a great article about ASP.Net Webforms Viewstate, and a thorough article about dot.net 4.0 Code Contracts.

Read More »