On a quest for the silver bullet..

» Currently browsing: C#


Law of Demeter: A real-world example

Number of Comments » 0

The Law of Demeter (LOD) helps decouple objects, it makes mocking intensive tests much easier to write, and it offers a concrete set of rules that can make things clearer.
I recently ran into an example in Glue where I refactored towards LOD. I will share my thoughts on that here.
The problem
I am working on [...]

Glue & Nu: Glue is a RubyGem!

Number of Comments » 1

No doubt, Ruby has an excellent package management system: Gems. Simply beautiful.
Also no doubt, we have not had such excellent package management system in the .Net-sphere. So why not just make RubyGems work for .Net as well? That’s exactly what Dru Sellers have done with Nu.
This is a great idea, so I decided right [...]

The Microsoft MVP Award

Number of Comments » 8

I am proud to announce that I have received the Microsoft MVP Award in C#, for my “exceptional contributions and commitment to technical communities worldwide”.
That means I am a C# MVP, and I am very proud of it!
I feel it is important for me to contribute to, and learn from, the technical communities around the [...]

Reflection and performance

Number of Comments » 4

The open source framework Glue that I’ve created, use a lot of reflection to invoke members on objects. This has sparked my interest in exploring the use of reflection in respect to performance. A colleague of mine, Åsmund Eldhuset, and I set aside an evening for a geeknight to get to the bottom of this, [...]

How I use the Glue mapping framework

Number of Comments » 6

Glue is a general purpose, bidirectional automatic mapping framework for the .Net platform, with strong verification and testing tools.
I’m actively developing it. I’m also actively using it. In this post I’ll share my experience as a user of Glue, and how easy it is to set up the mappings using TDD.
The example
We want to create [...]

Glue – the new mapping framework

Number of Comments » 7

I’ve spent this summer implementing a new mapping framework for the .Net plattform: Glue.
You’ll find examples and code here: http://glue.codeplex.com
Glue is a general purpose, bidirectional automatic mapping for the .Net platform, with strong verification and testing tools.
I’ve seen quite a lot of less than optimal handling of mapping issues in quite a few projects over [...]

ASP.NET MVC: DefaultControllerFactory is not thread safe!

Number of Comments » 5

I am not sure if this is a bug or a “feature” of the ASP.NET MVC framework. Either way, this is something you should be aware of as it can cause some very hard to track concurrency issues which might leak information between your HttpRequests.
In my last project we used the ASP.NET MVC framework along [...]

ASP.NET MVC: Let StructureMap create your controllers

Number of Comments » 5

For those of you already familiar with StructureMap and want to use it to configure your objects in ASP.NET MVC, read on.
The ASP.NET MVC framework has a default controller factory (DefaultControllerFactory) that requires all controllers to have a parameterless constructor. So, if you want to inject your dependencies to the constructor, you can’t do it. [...]

Creating a dynamic xml reader with C# 4.0

Number of Comments » 3

“The static type dynamic” was the catchphrase at PDC’08 when talking about what’s new in C# 4.0. The dynamic type seems to be introduced mainly to simplify the code you write when doing Com interop. But many also see this as a step towards the dynamic languages for C#. I like C#. I also like [...]

Looping collections in C#

Number of Comments » 3

In this post I want to demonstrate that with a few nice language features in C# we can do more with less when working with collections, meaning expressing more with less code.
There are a couple of points I want to make here. First I care about writing code that can be easily understood after it [...]