Ayende @ Rahien

Unnatural acts on source code

Bumbler: NHibernate Dynamic / Interactive Shell

After reading a bit about Jasper, I decided that I would like to see what it would take to build it with NHibernate and Boo. I am going to implement it and write the post at the same time, so you would get near real time documentation of the process.

  • 18:05, decided that I want this syntax:

    import Bumbler

     

    conStr = "Data Source=localhost;Initial Catalog=Northwind;Integrated Security=True;";

     

    bumble = Bumble.Through(conStr)

    for customer in bumble.Customers:

          print "Customer ${customer.ContactName}"

    c

    = bumble.GetCustomer("TRADH")
  • 19:10, finished building client interface and quick & dirty mapping from database implementation.
  • 19:24, finished code generation, now working on runtime compilcation...
  • 19:54: finished runtime code generation
  • 20:13, can now successfully query the database using NHibernate just from connection string. Starting to work on dynamic implementation.
  • 20:16, done basic dynamics, now playing with Booish.
  • 20:21, the code above now works, and I am going for dinner.
  • 21:10, back from dinner, final polish...
  • 21:13, done!

So, about two hours of work, most of which had to do with generating the mapping from the database. I have cut some corners there, so it is SQL Server only, and it can't support a legacy app, adding support for the more complex cases is simply adding it to the mapping generation, nothing else. I made sure that adding new functionality would be easy, however.

Right now, you can get the code, just run the application, and you will get a shell that you can use to interact with the objects and the database. You need to start a new Bumble (you can simply cut/paste the code above) and then play with it. You can also reference the assembly and work with it directly using Boo.

Getting the code:

svn co https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/SampleApplications/Bumbler

Comments

Rodney
05/04/2007 08:36 PM by
Rodney

What is Bumbler? Google returns no results.

Thanks.

Ayende Rahien
05/04/2007 08:38 PM by
Ayende Rahien

bumbler


Noun

  1. someone who makes mistakes because of incompetence

(synonym) bungler, blunderer, fumbler, stumbler, sad sack, botcher, butcher, fuckup

(hypernym) incompetent, incompetent person

(derivation) botch, bumble, fumble, botch up, muff, blow, flub, screw up, ball up, spoil, muck up, bungle, fluff, bollix, bollix up, bollocks, bollocks up, bobble, mishandle, louse up, foul up, mess up, fuck up

Ayende Rahien
05/04/2007 08:38 PM by
Ayende Rahien

I would be surprised if you heard about it, this post was literally when I created it.

Shawn Wheatley
05/04/2007 08:42 PM by
Shawn Wheatley

Ok, how about a link to what Jasper is? Either way, very cool work Ayende!

Ayende Rahien
05/04/2007 08:53 PM by
Ayende Rahien

Jasper is a dynamic extension to the entity framework.

For more details: http://fredrik.nsquared2.com/ViewPost.aspx?PostID=426

Andres Aguiar
05/04/2007 09:05 PM by
Andres Aguiar

OK, and how long does it take to build Astoria? ;)

Ayende Rahien
05/04/2007 09:29 PM by
Ayende Rahien

Not planning to.

I really don't like the idea of exposing my database to the world in such a manner. CRUD API are not the proper way of dealing with Web Services. The reason for Bumbler was simply because I read about Jasper and thought "Hey, this isn't anything I can put together in a few hours".

I guess I am not in favor of people making a big deal out of very simple things.

Ayende Rahien
05/04/2007 09:30 PM by
Ayende Rahien

That said, I estimate that building that on top of Bumbler's Sceham2Mapping is a matter of a day or so.

Ken Egozi
05/05/2007 11:03 AM by
Ken Egozi

@Ayende:

the "code" link is bad.

points to a port no. that is not available.

manually removing the port from the url got me to the right location

Cool work.

Ayende Rahien
05/05/2007 11:48 AM by
Ayende Rahien

It actually is not bad, but there is a referral protection scheme in place, probably. I removed the link.

neuruss
05/09/2007 06:14 PM by
neuruss

Alright dude, now you have three hours to write SilverLight...

Ayende Rahien
05/09/2007 06:19 PM by
Ayende Rahien

It is going to be though to do it with NHibernate, can I get four?

Comments have been closed on this topic.