Austin and Kaizenconf Part 1 - workshops

Unfortunately the images to this post were lost during the migration from Blogengine.Net to WordPress

It's finally there, Jan and I departed from Belgium to Austin, Texas to attend Kaizenconf. I have been looking forward to this for quite a while. It didn’t start out good when I spilled my first drink on the plane, but it only got better from then on. After a long flight with a stopover in Atlanta we arrived at the Austin airport. A lot smaller then I expected but that didn’t really matter.

Advanced NHibernate

On the first 2 days of Kaizenconf some promising workshops where scheduled, we decided to go listen to the great ayende talking about Advanced NHibernate. The talk started off with a blast when ayende gave a demo of the NHibernate Profiler that is being developed. Although beta it looks like this will be a real hit and it will help developers to get to know and control NHibernate better. I don’t see myself as an advanced NHibernate user but it was nice to follow a workshop that isn’t the usual introduction on how to create a Northwind CRUD application.

Below is a screenshot of the NHibernate Profiler, although it’s not the best of quality you can see the query that NHibernate has generated, the different queries that were fired onto the database and much more. Very, very promising!

Another topic that was explained is the use of Lucene with NHibernate. By using a couple of attributes on your domain models to indicate which parts should be indexed, you get a very easy way to make your data searchable. Because the original is always better, here is a short video where the advantages of using Lucene with NHibernate are explained:

We went on to NHibernate caching and again I discovered something that will change the way I use NHibernate on a daily basis. Seems like caching is actually very intelligent but, as with everything, you have to watch out not to shoot in your own foot. Oren showed us an example that called the database 4 times without using any caching and called the database 42, yes forty-two, times with badly configured caching.

Here are some random notes I took that I’d like to keep in mind for future use of NHibernate:

  • When loading an object via session.Load the query gets fired when the object is being accessed, not when the Load() function is called
  • NHibernate solves threading issues with caching by returning different instances of the same object to different users
  • Queries can also be cached, call the SetCacheable(true) function on every occurrence of the given query you want to cache

After this excellent session we were looking for something to eat. Luckily some of the attendees (thank you Chris and Tim) were kind enough to give us a ride to Rudy’s BBQ where we learned that ‘Real people eat meat’. I don’t think they have a lot of veggies under their customers.

Functional programming - Is it a game changer?

For the second workshop a difficult choice had to be made. It was choosing between the DDD chalk talk of David Laribee or the workshop about Functional programming of Matt Podwysocki. You probably already guessed the one I chose. This was something completely different then the NHibernate talk and Matt asked several times if our brain hadn’t exploded yet, and if I’m honest I had to answer yes every time he asked it. There was a lo-hot of information to take in.

The first part of the presentation was about making C# more functional. By heavily using the new features in C# 3.0, a lot of for-each loops could be eliminated with the help of stuff like LINQ and lambda expressions. Matt told us that F# is very good at math stuff, the software that determines the best player in Halo 3 is written in F#. Because F# has a specific purpose, there will never be a designer to create GUI’s or web pages using F#. I think I heard a little cheering in the room after those words. I still have to take a closer look to the abundance of examples Matt provided us to be able to give a deeper insight into F# so I’ll leave it at that for now.

Although I’d like to show a piece of code that Matt shared to point out the dangers that come with lazy evaluation of code:

Func<String> GetContent;
using(StreamReader fileStream)
GetContent = fileStream.ReadToEnd();
String content = GetContent()

Because the fileStream is out of scope when calling the GetContent function reference, this will give unexpected behavior which is very hard to debug if you ask me. Another good session for which I’d like to thank Matt.

The conclusion of the first day of kaizenconf is very good. As I already said the sessions were of high quality. I’m already looking forward to day 2 which has an ASP.Net MVC session given by Jeremy Miller and Chad Myers. Very exciting!