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,550

filter by tags archive

ReviewMicrosoft N Layer App Sample, part X–Architecture for the Space Age

time to read 2 min | 370 words

imageContinuing my review of http://microsoftnlayerapp.codeplex.com/, an Official Guidance (shows up at: http://msdn.microsoft.com/es-es/architecture/en) which people are expected to read and follow.

Well, this is probably going to be the last post on the topic, because to be frank, I am getting a headache and I don’t really see the point anymore. I would strongly advise anyone looking at this sample application to consider it to be the epitome of worst practices and what not to do. I am frankly stunned to see something like that.

I didn’t spend a lot of time with the application, and I more or less just skimmed it here and there, and almost every single time, I found something that horrified me.

Yes, there are places for disagreements when you discuss software architecture, places where a decision can go both ways and while you might disagree with it, you can live with it.

This isn’t such a case, this is a case of a project that is literally choke full of traps and scary places. If you don’t look too deep, it says all the right things, but once you get a bit deeper, you can see how this is causing a black hole in your mind, eating away anywhere where good things can grow.

This is the ultimate architectural exercise, building an architecture without building an application.

Except that you can’t talk about an architecture in isolation, architecture is always driven by the actual needs of the application, not by whatever the architect read about last night and is dying to see how it works in the real world.

This isn’t how this it done, and attempting to follow the guidance in this manner would result in a lot of time and money going down the drain.

I can’t emphasize this enough, avoid this codebase, don’t look at it, and never try to follow anything shown there, it will end in tears, pain and suffering.

I have a headache now, and I think that I’ll stop before it goes over the top.

More posts in "Review" series:

  1. (03 Dec 2013) Getting started with LevelDB
  2. (20 Jul 2011) Microsoft N Layer App Sample, part X–Architecture for the Space Age
  3. (15 Jul 2011) Microsoft N Layer App Sample, part IX–Not Invented Here is FUN
  4. (13 Jul 2011) Microsoft N Layer App Sample, part VIII–CRUD is so 90s
  5. (11 Jul 2011) Microsoft N Layer App Sample, part VII–Data Access Layer is GOOD for you
  6. (08 Jul 2011) Microsoft N Layer App Sample, part VI–Single responsibility principle is for idiots and morons
  7. (06 Jul 2011) Microsoft N Layer App Sample, Part V–Cross Cutting is a fine line
  8. (04 Jul 2011) Microsoft N Layer App Sample, Part IV-IoC FTW
  9. (01 Jul 2011) Microsoft N Layer App Sample, Part III–Abstraction is as abstraction does
  10. (30 Jun 2011) Microsoft N Layer App Sample, Part II–getting lost in the architecture
  11. (29 Jun 2011) Microsoft N Layer App Sample, Part I
  12. (12 Oct 2009) GoGrid vs.Amazon EC2
  13. (12 May 2009) C# in Depth
  14. (02 Sep 2008) Hibernate Search in Action
  15. (04 Jun 2008) Umbrella project
  16. (04 Jun 2008) Mass Transit Samples
  17. (23 Aug 2005) iRiver H340



Wow, not one single negative review here. Curious.


Or here. How can -anything- get 100% five-star reviews?



Out of curiosity, has anyone involved in writing this guidance contacted you or responded in any way?



Read the comments in the first two or three postings, there are few that either have worked on the project or are close to those that have since they insist that Ayende is giving a negative review as some sort of publicity stunt.

David Fauber

How can -anything- get 100% five-star reviews?

Saddam had 100% approval.


Always constructive comments ... why do not you enlighten us on how we must do!!! Only bla bla bla!


@Marta - sometimes there are so many problematic areas (or the approach is simply so wrong) that fixing it is more work than creating a whole new solution that people can learn from (seems that is the intention with Macto).

You don't try to turn a Fiat Punto into a race car (you would have little of it left, if you tried anyway).

João Bragança

@Ayende on the contrary, everyone should read it and get their eyes burned. Only then will they learn.

@Marta, read the Macto series. He is enlightening us.


@Rabo, can you see a trend of the people who gave those reviews? Mostly people from Spain, couple of others from Latinamerica. Not that that is bad, but the fact that it was created by Spanish developers would influence their reviews.

Also probably none of those developers are considered experts in their fields, like Ayende is considered by a lot of people (me among them).

There's nothing wrong with wanting to guide people, but when an expert (and some others) make observations like the ones Ayende did, and the project creators don't realize that they might actually take people the wrong way, it's kind of sad. The thing should be pulled off completely.

I'm not a guru by any means, but I read all of the posts of this series and I understood each of the problems pointed out and agreed that they were a problem.

So please stop trolling around trying to defend the so called guidance and please use that time to learn. Lot of great posts right here on this blog.


@Gabriel: Rabo actually has a valid point - because at one point there was actually a 1-star review that pointed to Ayende's review (as well as some 4-star ones). They have gone missing in the mean-time (probably the justification would be that Ayende's review is for v1).

That is a very bad way of treating critique.

Paul Cox

I'd love to know who ultimately manages sample projects from MS and the process they go through to create applications like this.

They have some of the best developers in the world, and see more real-world applications built on .NET than any other company.

Is the decision to create these kinds of applications a conscious decision rather than just a technical weakness?


If you are not for the faint of heart and would like to see a top notch architecture, try reviewing and studying the Orchard CMS project. Some argue it is way over engineered, but for the platform extensibility they are after...its pretty spot on.

Just my 2 cents.


Hi all, This is Cesar de la Torre, from Microsoft. I'd like to highlight that we've been taking into account every post that Ayende has been publishing about our initiative. You can read my post about it at my blog: http://blogs.msdn.com/b/cesardelatorre/archive/2011/07/21/about-ayende-s-blog-posts-series-reviewing-the-nlayered-sample-app.aspx We'd be thankful to any constructive feedback you can provide.

You can provide specific feedback directly to me: 'cesardl at microsoft.com' Best regards, Cesar


@Paul -

Re. "They have some of the best developers in the world, and see more real-world applications built on .NET than any other company" - I would not assume anything like that. The following post might shake your world: http://rethrick.com/#waving-goodbye

Real-world ignorance from various established dev teams and academia too isn't a new problem, but apparently now it has more severe effects...


The review was interesting, but harsch as well. I read Cesar de la Tore's blog entry he mentionned above. There is a second version of the app already published.

Ayende is a giant in the .net world and his comment can be devastating (i.e music store). The same applies here: now the v2 has been released fixing many critical issues, what's the point of being so harsh?

Ayende Rahien

Roland, When I wrote those reviews, there wasn't a V2.


@Gabriel - I wasn't "trolling around" trying to defend this sample at all. I was pointing out that a sample with so many problems having no negative reviews seems suspicious. I don't think it's very ethical to suppress negative reviews of one's work, if that's what's going on.


Would be interesting to see you follow up with a review of the V2 too. I enjoyed reading it because it highlighted some points i wasnt aware of. Thanks for that. Having a second opinion is a good thing. I dont really think you were too harsh, only honest, and i like honest.


@Ayende, I mean now the v2 has been released, your review on v1 is, say, fair and honest with an emphasis on negative aspects. As Cesar wrote: "all the issues were fixed in V2.0 before Ayende published his series." It would be also fair to take into account how the stuff has evolved.

To me it would be interesting to review how the v2 has evolved from v1 based on limitations and mistakes you and the community point out. Sure it would be an in-depth series, but it would provide a truckload of knowledge to everybody.


@Roland ...Totally agree! Ayende be constructive and a little bit less "spocchioso" (haughty, conceited)!


So we know for now what we should't look at, and what about good codebase?


Ayende, you should do stand up comedy. Whenever I look at dodgy code, I've just got you in my head telling me how this code would give you a headache.


For me, I've been compiling the review and I am going to read the code base precisely as a "What not to do" so I can improve my skills and pay attention to detail.


Ayende, you should publish at least one final post, where you clearly state that your reviews were for V1 of the sample project.

Of course a (quick) review of V2 would be even better ;-)


Please see @Cesar comment in this post!!! QED: humility (Cesar) vs arrogance (Ayende)! IMHO

Alex Simkin


When you write a guidance, you supposed to already know where you are going to guide your followers. You can ask "is it clear what I am sayng", not "is it correct". So, it was arrogance on the side of the guidance team to consider their work to be a guidance for others.


@Alex It's not a diktat! We live in a time of sharing! The project is on CodePlex, if you want to help the community, you can contribute in a constructive way! The arrogance is not the right way!

Alex Simkin


You didn't get it. It is not open source project asking for contributions, it is "diktat" from Microsoft on how we MUST use their technologies.



I've been following the blog for years and really appreciate the insight I've gained from your code reviews etc. I've worked with C# and Java, and have to say, in my work experience, MS developers[the ones i worked with], rely on MS to provide 'guidance' and if it's not 'blessed' by MS, then it's questionable. Whilst, I didn't find that with the Java developers[that I worked with], there was more 'community' effort in figuring out 'best practices' and not relying on Sun/Oracle. So I definitely appreciate you pointing out the misguidance and hopefully some will drink a little less MS Kool-Aid. :)


@ Alex Sure, it is a Diktat! ...on the project's homepage we can read: "We'll be happy hearing from you and getting your feed-back to improve and evolve this Architectural example!!". Yes Alex, sounds like a diktat, I'm terrified! Pleaseeeee. Be honest!

Alex Simkin


Apparently words 'official guidance' have different meanings in our languages.

“There are three classes of people: those who see. Those who see when they are shown. Those who do not see.”

Alex Simkin


This is what's written on the web-site: "Following these guidelines offers important benefits regarding quality, stability, and especially, an improvement of future maintenance of the application"


Just a short note to all the naysayers out there, if you don't like this project and guidance either don't use, contribute to it, or make your own project to enlighten us all. Too many people in the world today would rather sit around and criticize others than stepping up and making a change to better what they think is wrong. At least these folks are trying to help the community regardless of whether you view that are correct or not. I have read Ayende blog for a while now and view him to be very intelligent and knowledgeable about these topics but that's not reason to bash others projects because of that. I like when he does point out a better way to do something as that is helpful for everyone. Even the people on the other project are encouraging that but for all of you commenters on here who are just bashing it because you’re jumping on the proverbial bandwagon; let's see you help the community out doing something the "right" way then. I personally can't wait till the Macto team either completes their project or gets more into it so we can compare that project with the other projects out there. That to me will be the ultimate learning tool. Just to be able to see the differences in the two projects, what one does better than the other, what one didn’t think of that the other did. It’s a lot like the swarm of books out there covering the exact same target. They all do something a little different. One book might encourage the author of another book to enhance the flaws they saw in a different book. All in all, evolution is a beautiful thing and if you can’t contribute anything to it besides a bunch of negative comments. Then move on! I want to spend time reading and learning informative material that I find on Ayende’s site as well as the N-Layer projects site. Thanks, Have a good day


@Alex There is an other class of people: who doesn't seem to like any code they didn't write! ...pls down from the throne where you're located and make a constructive criticism without arrogance! For me that's all. See you.



Please stop, you're embarrassing yourself. Considering that Microsoft Spain has completely re-written the app and have admitted themselves that v1.0 was substandard, I'm not sure where you are going with any of your comments.

They put out a horrible, horrible guidance, one that will be causing problems for years to come since v1 had thousands of downloads and has likely been copied into hundreds of code bases already.

When it comes from the mothership (or the mothership's branch in Spain) it is treated as gospel, NOT as a collaborative project. How it is that people can't see this is beyond me.

Finally, with respect to your last comment, saying Ayende just don't like this code. Are you saying that the code in v1 was good? If so, you're invalidated any opinion you have on the subject. Microsoft Spain has admitted the code sucked, why can't you?


That last paragraph should read:

Finally, with respect to your last comment, saying Ayende just doesn't like this code because he didn't write it.


It can be argued that the value in such a classroom project is negligible.

Have you thought of reviewing software currently in use. For example NopCommerce - http://nopcommerce.codeplex.com/


@M I really wonder nopcommerce code review :)

Nick C

I'm surprised that no-one here has thanked Ayende for taking the time to do these reviews (though it has been done in previous posts.)

Particularly @Marta: the Microsoft guys got a free code review from someone who obviously knows more than they do. What's there to complain about? So what if you don't like the tone it's written in - there's still a lot of constructive criticism there.

Nick C

And to continue in the same vein - I'm surprised by people asking for a review of version 2.0. Those code reviews take time to do, perhaps Ayende has better things to do than offer free consultancy to MS.

Jay R. Wren

Does this mean I also should look at guidance based on similar N-tier stuff?

e.g. http://msdn.microsoft.com/en-us/library/bb882690.aspx is "Walkthrough: Adding a Local Database Cache to an N-Tier Application"

and "Local Database Cache" sounds interesting and I'm not sure of a great way to do it myself.

Ayende Rahien

Jay, Local DB cache? Haven't looked at the link, but that is fairly common when you are talking about distributed architecture. Making remote calls is expensive, and this can reduce them significantly.

Comment preview

Comments have been closed on this topic.


  1. The worker pattern - about one day 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