Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,319 | Comments: 46,932

filter by tags archive

Month Summary

time to read 1 min | 161 words

A month ago, I was caught red handed, with no post in a span of eight hours or so. I decided to see just how much I can post if I really put my mind into it.

This is my 150th post for this month, and obviously the last one.

Here is a chart of my posts in the last month by day, the most prolific day was the second day of the month, which actually warranted 17 posts.


It has been an interesting experience, but it turns out that it takes a lot of time, so I think that I will drop back to a saner(?) 70 - 90 posts per months instead. If nothing else, blogging has actually reduced the time that I can dedicate to writing OSS stuff and (more importantly) actually having a life outside the monitor.

Observations on Learning

time to read 2 min | 315 words

Here is an observation on learning. When I was at high school, I was thought Pascal, and I couldn't for the life of me understand dynamic memory allocation. I had little problem with everything else, but dynamic memory allocation (better known as pointers) was a mystery wrapped in an enigma stashed inside a headache.

About a year later, I was learning C++, and was one of the first in the class that grasped pointers and their usages. I remember trying to explain ***pppHead (sparse matrix) to another student, and he drew blank after the first level of indirection. I don't think that the quality of the teachers was that different,  and the material is basically the same, but I grokked the second and couldn't figure out the first.

I have run into this many times since, usually a piece of technology just doesn't make sense to me, and at one point, it clicks together, and it is "Oh, that is simple!"

For a while now, I have been feeling my lack of knowledge in the area of parsers, and I kept trying to learn ANTLR on my own. I got to the point where I could read EBNF fairly well, and actually make sense of it, but taking the next step to actually building a language has been beyond me. Yesterday I picked up The Definitive ANTLR Reference, and I have been going through it with a fairly rapid pace. I don't think that at my level, the book is offering something that isn't already available online, but I have been able to understand how things mesh together much better now.

I feel that now, I am not competent with parser building, it is certainly something that I can be with a reasonable amount of real world practice. In other words, I think that I am going to be able parsers and parser building to my toolbox.

BrailDSL Support Information

time to read 1 min | 114 words

Harris has more details about the internal implementation of Brail's DSL Support

Following the same line of thoughts, Alex has a similar implementation using C# 3.0. Personally, I think that Alex's implementation is cool, but it looks really similar to LISP, and that sort of scares me. I am currently reading about ANTLR, so it actually makes sense, in a weird way, except that I keep looking for the lower level implementation.

And as long as I am busy in link aggregation, Tom Opgenorth has posted a guide to Binsor, including a Getting Started example!

What would you say if I wanted to write my own... OR/M / IoC / Web Framework / Etc ?

time to read 2 min | 265 words

Occasionally I get asked this question, and the answer I give is usually along the lines of: Why?

This is not a mocking question ( :-)  ), it is the criteria that I use to answer this question.

  • Are you doing it because you want to and it is fun?
  • Are you doing that to solve your own problems, and you decided that you will get better return of investment by building your own custom thing?
  • Are you doing it to solve a specific problem, without an off-the-shelf solution?

If it is any of the above, I would tell you to:

  • Have fun,
  • But look at the existing stuff first, see what the reasons for this is.

If it is something along the lines of:

  • Building it seems simpler than investing the time in learning how to use existing stuff
  • You have a policy of From-Vendor-XYZ-Or-Built-In-House
  • You need new challenges and haven't written a framework in a week or two

Then you really want to consider this twice or thrice.

I once had a client reject NHibernate and ask me to build their own custom OR/M implementation, because it didn't come from Microsoft, and they had a policy that all their stuff is either Microsoft or their own. NIH in its purest form. After showing some metrics about cost, supportability and bus factors, I have been able to convince them that this is not a really good idea, and they have been using NHibernate with great success for the last two years.

Jimmy Nilsson has some more thoughts about this subject.

Visual Basic User Group Talks, Next Wendesday

time to read 2 min | 384 words

Oh, another thing that is worth mentioning is that I am going to talk about Test Driven Development and Interaction Based Testing at the VB.Net User Group meeting next week (Wendesday, 04 July, 2007).

More details can be found here: http://www.renaissance.co.il/ivbug/

The first one is:

Getting to know Test Driven Development & Design

You have just finished implementing the new WizBang 2.0 feature, and you are feeling pretty good about yourself. But, do you know if this feature broke? Testing using F5 isn't scaling beyond the simplest application, and the cost of maintaining software is often several times over the cost of building it.

The second one (I gave that one in DevTeach):

Interaction based testing With Rhino Mocks

Beyond the simplest scenarios, all objects had collaborators that they work with. This flies in the face of testing objects in isolation. This is the problem that mock objects were created to solve. In this talk you will learn what mock objects are, how to utilize them and best practices on when / how to utilize them. Rhino Mocks is a mock objects framework for .Net whose core goals are to let the developer rely on the compiler work well with refactoring tools.

The last time I did any serious VBing was quite some time ago, so I encourage you to come and watch how I humilate myself in public ;-)

DevTech session: Storming Castle Windsor & NHibernate

time to read 1 min | 126 words

I am announcing this a bit late, but I am going to give a talk about the Castle Winsdor & NHibernate on Thursday next week (03 July 2007).

The anouncement has an amusing typo, I am afraid, which bring to mind some horrifying options


The talk will be at DevTech, a conference that my company is arranging, so a lot of the people that I work with are going to give interesting talks.

You can get more details here.

Oh, and apparently I am an architect :-)

Hibernating Rhinos - Episode #4: Hibernating Forums - Part I - Testable & Painless Persistence

time to read 1 min | 150 words

Okay, here is the first episode in my OR/M challenge series. It mostly deals with the MonoRail skeleton project and with setting up the domain model in a TDD fashion. I am not sure how interesting it is, because about 60% of it is building the Active Record entities, and explaining how it works, but it lays a foundation that I will use for the next few episodes.

Lots of Um..., I am afraid, but at least I am speaking in a normal speed :-)

  • Total length: 55:44 Minutes
  • Download size: 77Mb
  • Code starts from ~4 minutes into the episode.
  • Getting the Latest code - will be updated for new episodes
  • Getting the Code from the episode

The download page is here: http://ayende.com/hibernating-rhinos.aspx

I have some ideas about where to take the next episode, but this is something that is mostly dependant on your feedback :-)

Dependency Injection in Web Forms MVC

time to read 3 min | 583 words

David Hayden has a post about the issue that you face when you are trying to use dependency injection in Web Forms MVC. I talked about similar issues here.

He points out that this type of code is bad:

    protected Page_PreInit(object sender, EventArgs e)
            // Constructor Injection of Data Access Service and View
            ICustomerDAO dao = Container.Resolve<ICustomerDAO>():
            _presenter = new AddCustomerPresenter(dao, this);
            // Property Injection of Logging
            ILoggingService logger = Container.Resolve<ILoggingService>():
            _presenter.Logger = logger;

This type of code a Worst Practice in my opinion. It means that the view is responsible for setting up the presenter, that is a big No! right there.

He gives the example of WCSF & Object Builder way of doing it, but I don't think that this is a good approach:

public partial class AddCustomer : Page, IAddCustomer
    private AddCustomerPresenter _presenter;

    public AddCustomerPresenter Presenter
            this._presenter = value;
            this._presenter.View = this;
    // ...

The problems that I have with this approach is that the view suddenly makes assumptions about the life cycle of the controller, which is not something that I want it to do. I may want a controller per conversation, for instance, and then where would I be? Another issue is that the view is responsible for injecting itself to presenter, which is not something that I would like to see there as well.

Here is how I do it with Rhino.Igloo:

public partial class AddCustomer : BasePage, IAddCustomer
    private AddCustomerPresenter _presenter;

    public AddCustomerPresenter Presenter
            this._presenter = value;
    // ...

The BijectionFacility will notice that we have a settable property of type that inherit from BaseController, and will get it from the container and inject that in. I don't believe in explicit Controller->View communication, but assuming that I needed that, it would be very easy to inject that into the presenter. Very easy as in adding three lines of code to ComponentRepository's InjectControllers method:

PropertyInfo view = controller.GetType().GetProperty("View");
	view.SetValue(controller, instance);

Hibernating Rhinos Status

time to read 1 min | 71 words

Well, I have finished the first episode of the OR/M Challenge, and it is now in the process of being uploaded to the server. I am going to sleep, based on some good advice that I received, so I will do the actual publishing in the morning.

What is really interesting is the numbers you can see here: http://ayende.com/hibernating-rhinos.aspx

Nearly ten thousands downloads for each of the previous episodes? Wow!


  1. Low level Voron optimizations: Primitives & abstraction levels - 16 hours from now
  2. RavenDB Conference Videos: Replication changes in 3.5 - about one day from now
  3. Analyzing RavenDB 4.0 with NDepends - 5 days from now
  4. The cost of counting: The silliest optimization… - 6 days from now
  5. The randomly failing test - 7 days from now

And 4 more posts are pending...

There are posts all the way to Mar 14, 2017


  1. RavenDB Conference videos (12):
    01 Mar 2017 - Delving into Documents with Data Subscriptions
  2. Low level Voron optimizations (5):
    28 Feb 2017 - Transaction lock handoff
  3. Implementing low level trie (4):
    26 Jan 2017 - Digging into the C++ impl
  4. Answer (9):
    20 Jan 2017 - What does this code do?
  5. Challenge (48):
    19 Jan 2017 - What does this code do?
View all series



Main feed Feed Stats
Comments feed   Comments Feed Stats