Ayende @ Rahien

Refunds available at head office

Using Active Record to write less code

The presentations from Oredev are now available, and among them is my talk about Active Record.

You can watch it here, the blurb is:

What would you say if I told you that you can stop writing data access code in .Net? Aren't you tired of writing the same thing over and over again, opening connection, querying the database, figuring out what to return, getting back untype data that you need to start putting on the form? Do you really see some value in writing yet another UPDATE statement?The Active Record framework allows you to fully utilize the power of the database, but without the back breaking work that it used to take. Active Record uses .Net objects to relieve you from the repeating task of persistence. Those objects are schema aware and can persist and load themselves without you needing to write a single line of SQL. Building business application using Active Record is a pleasure, the database stuff just happens, and you are free to implement the business functionality.

To be frank, I consider this to be one of the best presentations that I gave. Everything just ticked.

Comments

Aaron Erickson
04/22/2009 05:40 PM by
Aaron Erickson

Are not available, or are now available?

Kyle Szklenski
04/22/2009 05:42 PM by
Kyle Szklenski

I think instead of "not" you meant "now". :)

Ayende Rahien
04/22/2009 05:43 PM by
Ayende Rahien

Yeah, probably one of my most common typos

Krzysztof Kozmic
04/22/2009 05:52 PM by
Krzysztof Kozmic

This video is Public

Using Active Record to write less code

Ayende Rahien, We!, Israel

Isn't this description like... not very up to date?

Anyway, thanks. This only makes me regret that organizers of CodeFest turned out to be asses, and I didn't get a chance to listen to you live.

Some other time.

Lucio Assis
04/23/2009 12:02 AM by
Lucio Assis

Awww, no pretty.png ;-)

David
04/23/2009 12:06 AM by
David

Fun presentation, thanks

John
04/23/2009 08:06 AM by
John

What's the performance of Castle ActiveRecord like? Is there much of a difference between it and NHibernate? Obviously it will be less efficient than NHibernate alone since it's built on top of it but how big is the gap?

Eric
04/23/2009 09:41 AM by
Eric

Do you plan on releasing a new version of ActiveRecord soon? One that binds to NH 2.1 and fixes bugs like discriminators not being filtered with a HasMany.

"Release early, release often" as the Google mantra goes

Ayende Rahien
04/23/2009 10:23 AM by
Ayende Rahien

John,

I have never been able to measure the difference.

Eric,

Yes

Krzysztof Kozmic
04/23/2009 11:01 AM by
Krzysztof Kozmic

Just seen it. indeed great presentation.

"Give me a model to work on" was golden.

But I think that date is wrong. If it was 2 months after NHibernate v2.1 was released it certainly was not 20 nov 2007.

Ayende Rahien
04/23/2009 11:04 AM by
Ayende Rahien

Krzysztof,

No, that was not in 2007, it was in 2008.

I think they had the wrong template :-)

Andrew
04/23/2009 04:03 PM by
Andrew

Good presentation, I enjoyed a few of the other ones I skimmed through as well.

As someone who has always worked for companies that are down right frightened of Open Source (especially for something as important as Data Access), I've only really played around with NHibernate and Active Record on my own.

So my question is, with Fluent NHibernate now on the scene, does the need for Active Record go away, or will the three of them play nicely together?

As a follow up, if I was going to start a medium sized project today (let's say something similar to the Hotel Reservation system from the presentation), would the ActiveRecord/NHibernate suffice, or would you (meaning anyone) suggest trying to integrate Fluent NHibernate into the project?

Thanks in advance.

Ayende Rahien
04/23/2009 04:18 PM by
Ayende Rahien

Andrew,

Today?

I would recommend going with Fluent NHibernate until your model has settled down, at which case I would move to HBM XML files, for custom configuration

Peter Morris
04/23/2009 04:23 PM by
Peter Morris

The slide in the video says November 2007, I presume that's wrong?

Do you only use AR for prototypes and very simple apps then? Do you ever just use NH and leave AR out of the picture?

Ayende Rahien
04/23/2009 04:27 PM by
Ayende Rahien

Peter,

I now tend to more and more use NHibernate only.

I used to use AR for speccing and prototyping, I use Fluent NHibernate for the same purpose.

In both cases, there is some cut off point where I cut out the middle man and go to the XML.

Trying to setup complex stuff in either AR or FN is just ugly.

Peter Morris
04/23/2009 05:23 PM by
Peter Morris

How does Fluent NH cater for protected / private state?

Ayende Rahien
04/23/2009 05:24 PM by
Ayende Rahien

Peter,

I have absolutely no idea :-)

Peter Morris
04/23/2009 05:41 PM by
Peter Morris

Nor do I, which is why I have stuck with XML in my experimentation :-D

Ayende Rahien
04/23/2009 05:47 PM by
Ayende Rahien

Peter,

Try the FN mailing list

Frank Quednau
04/24/2009 07:45 AM by
Frank Quednau

"I don't have to think, let's do UML" - Love that one!

Vincent
04/25/2009 02:08 AM by
Vincent

Is this required specific NHibernate library? I try to create the example by using AR, it doesn't work

MikeS
04/25/2009 07:23 PM by
MikeS

Great presentation. Something I learned when doing presentations: when someone asks a question, repeat it before answering so everyone can hear the question. None of the questions you answered were audible :-(

Comments have been closed on this topic.