Pair programming benefits and arguments

As I wrote earlier I attended my first ever Alt.Net un-conference this weekend. It was very rewarding and great to meet fellow developers under such informal circumstances. The open spaces was the most rewarding part I think. One of the open spaces I took part in were about Pair Programming. It soon evolved to a session about how to convince developers / management and other that it’s a good idea. Here is a short recap of some of the good thoughts that emerged from that session. Good ideas Switch the keyboard often. I.e. one developer writes the test and one the implementation or use some kind of a pomodoro clock for ten mintues. Switch partners often – once a day for example Argument for the benefits of Pair Programming It’s fun! No more agrument should really be needed than this. You need fun at work or else you should work...
Read More

Marcus doing new stuff

Two big things will (or are in the progress of) happen this weekend. The first is that I have gone over to the dark side. Yes, I know, I couldn’t resists anymore. The temptation was to great. I have bought a Mac Book Pro. And have just installed it – that process was so smooth. I want to do it again! OK – the next thing is that I will speak at a conference for the first time ever. Actually it’s a Un-conference, for alt.net Sweden. And it’s a lightning talk but that only makes it harder I think. 10 minutes – it’s not much. The subject is “Let Fluent NHibernate test your mappings”. And it relates to some of my late findings. I know that I have spoken some bad words about Apple so I suspect some pretty harsh comments from some areas (Fredrik? Magnus? Svante?). Shoot! I am...
Read More

AutoMapping with FluentNHibernate

I ran across this post by Ayende and it pretty much sums up where I want to reach with my persistence ignorance efforts: “After that, you are done. Just create an entity in the proper place, hit the /database/create and have a lot of fun.” I of course like the fun-part of the quote the most. :) But seriously – that what I want to reach – to configure my conventions. And then simply code the model as I want it and let the framework (NHibernate in this case) figure out how to store it. Well, as it seems, the Fluent NHibernate framework has been updated since the Ayende post. So I’ve read, and read, and read and discovered some shortcuts. By the way – here is an article on how to make the transition from the “old” convention-style into the new. I have put together an updated sample for...
Read More

Fluent NHibnerate CheckReference throws Expected ‘X’ but got ‘XProxy’

I have been playing around quite a lot with Fluent NHibernate lately and ran into this problem a couple of times. What happens is that when you set up a mapping test with PersistenceSpecification<T> that tests a reference (with CheckReference for example), an exception is throw like this: System.ApplicationException: Expected ‘Marcusoft.Product’ but got ‘ProductProxy…’ for Property ‘Product’ This has to do with that NHibernate creates a proxy-class and doing Equality-test on that class. I have picked up a base class that “fix” this problem from the Hibernating Rhinos (my god! what a name…) You can read about it here or read my code here.
Read More

Vasa Band and Saturday night success

This weekend the band I play in, the Vasa Band, had an opportunity to play at the Salvation Army regional congress in Örebro. We were invited to play in the musical festival at Saturday. When we learned about this a few of us started to think in how we could make something new and different. And so we borrowed ideas from some great bands and put together a short program with music from our latest CD – Priority. It was very well received and we really made a big impact. But what felt very good was many people felt the presence of God and his message to them as we played. This is always our greatest hope and longing. And this Saturday it was very obvious. Feels really good to continue on that road with my fellow bandsmen/women. I’ll try to upload some photos from the evening later
Read More

Dos-script to delete all Visual Studio Intermediate files

I have a USB-stick which acts as my backup. As I program a lot compilation and unit testing produces a lot of trash (.pdb, Test Results, obj-files etc). I don’t want or need a backup of those. Today I found a short script that removes those file. Since I have folders named “bin” I want to keep I tweaked it a bit into this: FOR /F "tokens=*" %%G IN ('DIR /B /AD /S Debug') DO RMDIR /S /Q "%%G" FOR /F "tokens=*" %%G IN ('DIR /B /AD /S _Resharper*') DO RMDIR /S /Q "%%G" FOR /F "tokens=*" %%G IN ('DIR /B /AD /S TestResults') DO RMDIR /S /Q "%%G" FOR /F "tokens=*" %%G IN ('dir /b /A /S *.vsmdi') DO RMDIR /S /Q "%%G" I don’t know if you are like me and don’t know the first things of DOS. Well this script deletes the following: All Debug-folders (both obj/Debug...
Read More

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