Test NHibnernate mappings with Fluent NHibnernate

After a couple of days in the Fluent-world I am taking to it as a fish to water.

One of the features that I am tried out and really think will be helpful is the ability to test your mappings. Especially nice is that you in your tests can switch to a in-memory database (with SQLite) so that your test run faster, and without having to setup a database.

I found a good introduction to NHibernate and Fluent NHibernate by the Hibernating Rhino Gabriel Schenker that also introduces mapping testing. Read it here (part 1, 2 and 3).

Love this quote by the way: “if you continue to implement your own data access code you are stealing (money) from your customer

Read More

Get rid of your xml – go Fluent NHibernate

After my very short experience with NHibernate I have already come to realize that lots of problems can arise from and in the XML-files that contains the actual mapping instructions.

Just the fact that they are XML gives you the classical problem of no compile-time checking and the possibility of calling things differently in the code and configuration.

Well, here is the solution; Fluent NHibernate. Their solution is simple – do it in code, in a fluent interface-style.

I just ran through their starter example and I like it. A lot. And some of it is almost magic. A good way to “let the storage issues be a consequence of the domain model”

Read More

First stop for learning events, delegates and anonymous methods

I found this great article about events, delegates and anonymous methods.

I always get lost in these matters and now-a-days you can have some really funky syntax with lambdas and everything (I mean who can honestly say that: “() => { }” is read- and understandable. Honestly).

OK – this guy (can’t find his name) has done an excellent write-up, with lots of links to other places if you want to go deep (but that’s really deep, bottomless if you want).

Read More

Implementing Unit Of Work with NHibernate

The more I work with it the more stupid I feel around what I have been doing before; why have I written so much SQL? It feel just … unnecessary. Who said stupid? Not me…

Jimmy Nilsson said something like; “I just want the database and storage problems to be a consequence of my domain model. I don’t want to think about it”.  And that is one of the goals with DDD and the solution is, for example, NHibernate.

I have been doing some labs with NHibernate the last couple. And as often with me – I think I am in love. NHibernate really rocks. The mapping files are quite hard to chew off at first and I suspect that there are many tricks and traps for me to find. But still – so beautiful.

Of course the Net has helped me a lot on my...

Read More

Object-oriented database – worth a try

I have been doing a very small lab with an object-oriented database, db4o, and I am very impressed indeed.

The concept a first is a bit hard to grasp since there are no tables, no SQL and hence no mapping going on. You simply store your objects.

Of course the trick is to query them back, but the excellent db4o-crew and chunking out code every now and then and for example the current release includes full support for LINQ which gives you and excellent programming experience.

I am still very much a newbie and have some un-answered questions on how data and class definitions evolution is handled. But it looks cool, very cool.

Just say it loud for yourself: “No more SQL. No more mapping.” Yeah, you like it, admit it.

Read More

Task Board for Team System – finally!

I have been quite harsh to the Conchango Scrum template for Team Foundation Server, and I actually didn’t like it when I used it last (8 months ago).

That primarily had to do with me being forced to use the standard, heavy-weight forms in Visual Studio to edit Backlog Items and Actions. That did that we couldn’t use it in our daily scrums and hence someone (read: me) had to take notes and then go an update the TFS. In lean terms this was WASTE that was added to our project. I didn’t like that one bit. So we stopped using it. Quickly.

But now Conchango has created the tool that I think was the missing link. A Task Board application that mimics the actual task board that you draw and edit during sprints, planning and daily scrums.

You can...

Read More

Why do TDD?

I haven’t done TDD for a very long time and I still am waiting for my first BDD project in real life. In fact I sometimes have a problem to describe the goodness.

But Gregg Pollack has done the same journey as I have and he has also done this great presentation on why TDD is good and how to use it.

Sadly that video is long gone. Sad, because it was a good presentation.

This is such a great presentation where he takes us through a series of points that explains the rationale of TDD and then BDD, or the “pathway to developer enlightenment”, as he calls it. I have extracted his points here:

  1. Testing breeds confidence
  2. If you write tests before you write your code, you end up writing better code
  3. Well written tests are just as good, if not better...
Read More

More great stuff on BDD

I have been doing some more reading on BDD, and I like it more and more, the more I read about it. I am working from my house today and Elin is getting a bit annoyed from every time I call out “Yes”, or when I am trying to explain how good this is.

The main thing for me, right now, is that using the BDD-technique gives you a way to derive the requirements in a iterative and exploring way. And in the language of the experts (the ubiquitous language).

I also is fond of the strict structure of a story and it’s scenario that Dan North describes in this article. Mainly because it gives you guidance in the process (“what is the next important thing the system doesn’t do”). Here are some other reasons from Mike Cohn

Being strict...

Read More

Pomodoro – being agile and focused on the individual level

I have been introduced to a new concept called The Pomodoro Technique. It’s a way to work in a very focused and lean way, on the individual level (it can also be used for groups).

From what I’ve learned so far it seems very powerful and is something that I sure will be reading more about, and try to use for myself. I often have trouble to keep my focus on the task at hand and the Pomodoro Technique seems like a great way of handling that.

Here are some resources that I found on the subject:

And finally a great lightning talk by Staffan Nöteberg on the problems that Pomodoro sets out to solve. In Swedish I am afraid…