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,128 | Comments: 45,548

filter by tags archive

There is no one correct way

time to read 2 min | 213 words

One of the major complaints about my recent series of code reviews is that I only say what you shouldn’t do, not what you should.

Well, this blog currently have 4,782 posts, many of which are actually talking about how you should design systems. I am sorry, but I really can’t repeat everything for each post.

I can specifically recommend the following series:

But really you are going to have to go over the archives and look. I am pretty good at assigning categories, and you might want to start with the Design category.

If you want to see how I write code, at last count, I had quite a few projects here: https://github.com/ayende

And last, but certainly not least, I can’t really tell you what you should do. There are too many factors involved to be able to do that honestly. People who assume that there is one correct way to do something also assumes that all projects are the same, with the same requirements, constraints and resources. That is not the case, and I try very hard not to provide any prescriptive design out of thin air.



I love this blog for your pragmatism. You should write a little about recruiting, now that you have done it.


I've appreciated all of your code review topics lately. By not providing direct solutions, you force your readers to think about the problems you've found. Apparently, some of your readership doesn't appreciate this - their loss.


No complaints here.I've enjoyed "The Wages of Sin" mainly because I've looked at these kinds of code-bases and wondered if my own skills and imagination are somewhat limited, or whether "yes, this is code noodling for the sake of it".

It's good to have folks like yourself and Karl Seguin around to dish out a few reality shots....even though we might not always like them :)


"And last, but certainly not least, I can’t really tell you what you should do. There are too many factors involved to be able to do that honestly. People who assume that there is one correct way to do something also assumes that all projects are the same"

You mean like "safe by default"?



The topic is indeed relevant and the pragmatism is very needed, but my problem is not the "what", but the "how". A bit more humility and a bit less facepalmish language would be befitting when performing unsolicited code reviews of someone's labour of love. Yes, when you put something out there as open source you should expect people to pick it apart, but it can be done with more empathy and style. The community would be better for it.

I agree that there is a risk that any "this is how it should be done" would automatically be regarded as best practice, just because it's Ayende and not John Doe writing it, and it's very true that such a best practice would often be the wrong thing anyway. But a bit of "currently, I think I'd do it like this, sort of..." would go a long way in improving the value of the criticism. Maybe even a "Hey, I'm going to pick your code apart publicly. I'd appreciate it if you would chime in with your blessing or at least your own opinions and experiences"...

Am I easily offended? Well, maybe, but if there's anything the .NET community needs less of it's bad, convoluted architecture and bashing. Let's not fight the former with the latter.


I've also enjoyed the recent code review series - I've gotten a lot more out of them than those seemingly interminable 'find the bug' posts. I've implemented nearly all of the (anti-)patterns Oren is picking out (and still do some of them).


Hi Ayende,

We know there is no one correct way, however you have alluded to a way you prefer to do this kind of stuff (eg. ayende.com/.../...it-of-doom-the-evils-of-the.aspx)

Use nhibnernate directly from the controllers, put resuable queries in query objects then call them from the controllers. You have also talked of having a service layer.

This alternative that you keep mentioning is what we really want to know about, not 'the correct way' to code. But we don't know how it would be structured. How do you deal with controller actions getting too large? How does this style handle large changes to the projects requirements? etc.

You must understand that you are going against what is generally considered best practice, so if you goal is to educate/help us out, it would be nice if you could throw us a bone.

Regardless, I have found these posts interesting, but this better way you mention is about 10 times more interesting :)

Dominic Pettifer

I looked through your github profile at https://github.com/ayende I can't see any ASP.NET MVC or WebForms projects. Do you have one by chance? Or could you recommend an open-source MVC project that uses NHibernate in a way that you would consider to be the correct way.


Got to agree with gunteman on this one.


Oren, could you change your blog a bit, so it shows the tags associated with current post? Sometimes I want to lookup for post similar to current one, but since there are no tags visible I could only guess what tags might apply


Nobody is asking for ONE correct way. A simple problem solving process though is what people are criticizing you about.


  • define the problem

  • why it will cause problems

  • possible solutions

It seems you do step 1 but avoid step 3.

Pointing people to your projects is silly for step 3, do you expect people to read thousands of line of code to figure out what you are getting at when you haven't even said what the issue and potential solutions are?

Comment preview

Comments have been closed on this topic.


  1. The low level interview question - 4 hours from now
  2. The worker pattern - 3 days from now

There are posts all the way to May 30, 2016


  1. The design of RavenDB 4.0 (14):
    26 May 2016 - The client side
  2. RavenDB 3.5 whirl wind tour (14):
    25 May 2016 - Got anything to declare, ya smuggler?
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series



Main feed Feed Stats
Comments feed   Comments Feed Stats