ASP.NET MVC, StructureMap, and … TDD?

I’ve been experimenting with ASP.NET MVC and StructureMap (an IOC container), and the integration has been quite smooth. For guidance on combining StructureMap with ASP.NET MVC, check out Elija Manor’s blog post. Be cautious of the favicon issue.

I’m also using NHibernate and Fluent NHibernate for a cleaner configuration compared to XML. If you need to set specific properties in Fluent NHibernate, this Stack Overflow thread provides a helpful example. Additionally, the TekPub NHibernate series and Kona project examples are great resources.

Now, onto the topic of TDD. While I appreciate TDD as my preferred coding method, I’m grappling with its application at a higher level. For example, how do I decide when to introduce a repository or an IOC container, and should I TDD the IOC code?

I’ve sought advice from the Swedish ALT.NET group and found that BDD and the concept of...

Read More

Visual Studio 2010 web.config transformation

I happened to run into a feature I didn’t know of… Visual Studio 2010 (beta still… soon RC) includes a function for managing different .config-files for different environments. And support for transforming them on build/publish.

Here is a MSDN-article that introduces the concept and use it. And here is an article on the subject.

Pretty cool since up to now you’ve had to do it manually with build-tasks… Not so trivial.

Read More

NUnit and the constraint based model

At the Elevate presentation yesterday I learned a lot about C#3/4 by Magnus Lidbom.

But as a side-effect I also picked up a nifty syntax for NUnit assertions. It’s called Constraint-based Assertion Model and has been around since NUnit 2.4. Which shows that I am a slow adopter… Sad.

OK – what’s the deal with it? It gives you a almost fluent interface to assertions. Here is an example on how to do a simple assertion in the old style:

And here is the same assertion in the Constraint-based version:

Now read it out loud; Assert… That … I … is equal to 10. Nice, isn’t it? I like that a lot.

Read More

Inbox zero

First, admit that the title alone is very tempting… You want it, you need it… but how to get it?

How do you manage the steady flow of mail and requests during a day? How do you stay afloat? That’s what you can learn from picking up on the inbox zero concept.

I first learned about this concept at a presentation by Scott Hanselmann at ÖreDev. You can see this presentation here. Mr Hanselmann has put out some other advices that are well worth reading as well.

I then realized that the concept is older than that presentation and was invented by Merlin Mann. He even has a site on the subject; InboxZero.com. But he looks so crazy on that video that I didn’t dare watch it ;)

Here is a great presentation Merlin Mann did at Google. It will take you through the...

Read More

TDD and legacy code

I have been doing some presentations on TDD and one thing that always happens is that you get some tricky questions in the beginning of the presentation.

As you’re introducing a new concept, it of course starts very small and easy, but most people directly try to put it into their context, their normal situation.

And let’s admit it – there are not very often cases where we start off in a void, aka. a green field project. No – it’s mostly brown field – there is always code that exists that needs to be handled. What’s worse – that code is not written to be tested – Not Designed for Testability.

I think this is a very interesting subject and it touches on other subjects that I’m interested in surrounding why it’s worth “clean up your room” (as Uncle Bob would have put it…)

There’s...

Read More

Trying Coding Dojo, Kata and Extreme OOP

In preparation for a presentation next week (which will go on for two days… brrr), I had my sights set on doing something about Extreme OOP or Object Calisthenics. I’m thinking of using that exercise to illustrate some OOP practices.

In the PDF file for the Extreme OOP above, you’ll find an excellent kata (the Commodore 64 kata) that will take you through all the rules of Object Calisthenics.

OK – but since I didn’t want to do that exercise all on my own, I hooked up with two Avega colleagues (David Blomberg and Magnus Forberg, great guys!) and we did some kind of coding dojo.

The findings were quite surprising.

  • First – the rules of Object Calisthenics are not meant to be followed when you do ordinary code. It’s simply an exercise to get you to think about OOP in a very structured fashion.
  • ...
Read More

Great tool for creating snippets

I love the snippet support in Visual Studio. It’s so much a part of what we do that we don’t even think about it anymore. Just like Intellisense way, way back – remember the time before that?

But one thing that always has been a bit messy is creating your own. And that Snippet manager – what is that? I’ve never been able to get to like it.

But there is help on the way; meet Snippet Designer. It can help you not only to create snippets from existing code, but also to manage your snippets in a nice way.

Read More