﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Brenda commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>Bad code, but probably payed it a lot.</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment41</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment41</guid><pubDate>Mon, 22 Aug 2011 18:06:51 GMT</pubDate></item><item><title>BNewer commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>Hillbillies,
This is an Architecture guide, not an example app for coding best practices.  When I look at this thread and think about how lost you all are it makes me sick to my stomach.
B
</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment40</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment40</guid><pubDate>Mon, 15 Aug 2011 18:20:29 GMT</pubDate></item><item><title>KierenH commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>Agree, ArgumentNull is an exception you don't handle - it means, you screwed up calling the API.

Then the Exception handler *shakes head*:
 - super lame using a static property (Current) to get a reference to the Inversion of Control container, and in the process coupling your class to the container
 - Unnecessary to abstract the container in _your app_ - or, if you do want to abstract the actual container implementation, maybe perhaps steer towards the service locator pattern (which is pretty synonomous with IoC):
http://commonservicelocator.codeplex.com/

Now, the Exception handling block:
The EntLib includes a class 'ExceptionManager', which is intended to be injected into your class. It allows you to handle exceptions based on a policy. The latest API lets you do:

exceptionManager.Process(() =&gt; { DoWork(); }, "policy");
(http://msdn.microsoft.com/en-us/library/microsoft.practices.enterpriselibrary.exceptionhandling.exceptionmanager.process(v=PandP.50).aspx)

The policy configures how exceptions are handled. Typical actions you might configure are logging the exception, and the subsequent processing action, whether to handle, rethrow, or throw a new exception.

You also get the ExceptionShieldingAttribute which you can apply to service boundaries, so that you don't have to to try-catch within every service method, you know, for the sake of it... </description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment39</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment39</guid><pubDate>Tue, 19 Jul 2011 16:02:53 GMT</pubDate></item><item><title>juanjo commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>definitely, this sample app and the guide it's an msft error. i'm sure they have the knowledge and the resources to do a better job.  </description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment38</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment38</guid><pubDate>Sat, 09 Jul 2011 15:31:15 GMT</pubDate></item><item><title>Tien Do commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>Because it's an Architecture official guidance, not a Coding guidance hehehehhe :D</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment37</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment37</guid><pubDate>Fri, 08 Jul 2011 03:29:18 GMT</pubDate></item><item><title>Kash commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>@iwayneo

About your first commentary, I have to say a lot of things, but I think that all of them are not very convenient to say here.

Apart of that, I think that all code is improvable, and this code in particular is very improvable. This is why they are developing v2.0...

I would like that you check out all  the sample code, not only the code that Ayende is showing.</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment36</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment36</guid><pubDate>Thu, 07 Jul 2011 17:34:01 GMT</pubDate></item><item><title>iwayneo commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>@kash

anything to add? :D</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment35</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment35</guid><pubDate>Thu, 07 Jul 2011 15:36:21 GMT</pubDate></item><item><title>Felice Pollano commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>Yes it is poor code, maybe the whole concept of "Official Guidance" is wrong. Guidance come from distilling experience from *many* different places and getting something satisfying you and others in your team. Pretending to be Official is evil.</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment34</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment34</guid><pubDate>Thu, 07 Jul 2011 07:49:26 GMT</pubDate></item><item><title>degorolls commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>Wow Ayende! I was reading some of your initial posts and thought you might be being a little harsh but looking at this I am truly shocked. This thing should be pulled down off the web immediately. If Microsoft want to put out guidance they need to use developers that have a wealth of real world experience not some guys that are clearly bloody novices. This is absolutely apalling and following this guidance will be a recipe for disaster</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment33</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment33</guid><pubDate>Thu, 07 Jul 2011 03:47:23 GMT</pubDate></item><item><title>Steve commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>Come on BobJ, the responsibility needs to be put on the developers.  They work for Microsoft and are putting out a guidance application, they shouldn't need Ayende to tell them how to do Exception Handling.</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment32</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment32</guid><pubDate>Thu, 07 Jul 2011 03:35:11 GMT</pubDate></item><item><title>Olcay commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>@Ayende 
sometimes i am thinking that God blessed open source and .Net community with you.</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment31</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment31</guid><pubDate>Wed, 06 Jul 2011 23:18:18 GMT</pubDate></item><item><title>Cosmin commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>@Manu
This is why log and throw is no ideal
http://skillsmatter.com/podcast/agile-scrum/fractal-tdd-using-tests-to-drive-system-design</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment30</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment30</guid><pubDate>Wed, 06 Jul 2011 21:08:56 GMT</pubDate></item><item><title>Leonardo commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>Also, by looking these extracts only, all that code seems to justify that not needed layer that is only delegating to other layer that offers the SAME services. What would be the point of doing that?</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment29</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment29</guid><pubDate>Wed, 06 Jul 2011 18:59:13 GMT</pubDate></item><item><title>Alex Simkin commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>@Greg Young

"Most of the value in DDD is in the journey" - yes, for consultants, not for the end customer. And, by the way, what we see here has nothing to do with DDD, authors are fighting with technologies that should be orthogonal to domain logic.</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment28</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment28</guid><pubDate>Wed, 06 Jul 2011 17:59:24 GMT</pubDate></item><item><title>Ayende Rahien commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>BobJ,
The problem is that then it puts means a lot of work on me to also points out the fixes.
However, most devs can find out by googling the terms I used. The link I gave you? I had no idea about that, but I googled WCF error handling, and got that in under a minute</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment27</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment27</guid><pubDate>Wed, 06 Jul 2011 16:48:32 GMT</pubDate></item><item><title>Darren Kopp commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>What happens when resolving ITraceManager throws an ArgumentNullException? Why aren't they handling THAT scenario?</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment26</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment26</guid><pubDate>Wed, 06 Jul 2011 15:35:57 GMT</pubDate></item><item><title>BobJ commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>@Ayende

Yes, precisely. I know this, and use this same exception strategy with WCF. Perhaps others don't, or maybe they use another less effective method, or maybe they do what the guidance suggests (cut/paste). My point was, I know this post was meant to be humorous(and it was, the "guidance" is quite shocking), but why not add your own guidance in as well? </description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment25</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment25</guid><pubDate>Wed, 06 Jul 2011 15:17:37 GMT</pubDate></item><item><title>Justin A commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>/me checks the date. Nope, not april 1st.

hehe! love the comments :)

@Manu =&gt; what happens if the 'logging' errors? zomg :(
Also .. more info: http://tinyurl.com/6dua7lq</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment24</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment24</guid><pubDate>Wed, 06 Jul 2011 15:14:48 GMT</pubDate></item><item><title>Greg Young commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>re: DDD Examples.

Part of the problem with building a "DDD example". Is that all you can really see is the code (likely the end point of the code). Very often you will come into this code and go "hey this is pretty simple" but what you can't see is the vast amount of work that went into getting there, you can only see the endpoint, not the journey.

Most of the value in DDD is in the journey, not in the endpoint.</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment23</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment23</guid><pubDate>Wed, 06 Jul 2011 15:12:01 GMT</pubDate></item><item><title>Ayende Rahien commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>BobJ,
Move all error handling out to an aspect?
I mean, it isn't like WCF comes with a builtin way to handle errors, right:
http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.ierrorhandler.aspx</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment22</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment22</guid><pubDate>Wed, 06 Jul 2011 14:58:15 GMT</pubDate></item><item><title>BobJ commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>@Ayende -

Fair enough. If you were doing a code review and you saw this, what would be your suggested resolution be? While this is funny, why not make it constructive too?</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment20</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment20</guid><pubDate>Wed, 06 Jul 2011 14:09:34 GMT</pubDate></item><item><title>Derek commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>@Christian a couple DDD examples, I don't think they fall under the N-Layered category though.  That's why I've been following this review and will follow Macto.  What is the best way to implement DDD and have different clients, like MVC, SL, and WPF, for example.

http://codecampserver.codeplex.com/
http://code.google.com/p/ndddsample/
</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment19</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment19</guid><pubDate>Wed, 06 Jul 2011 14:08:31 GMT</pubDate></item><item><title>David Fauber commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>Man, this so closely resembles some code I've just inherited and
"I mean, did at no point someone stand up and said: “My Ctrl+C / Ctrl+V keys just fell off, we might need to think about a better way of doing this"?"
pretty much sums up my feelings exactly.  Its pretty terrifying that people that write such code can now be like "hey its best practice per MSFT!".</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment18</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment18</guid><pubDate>Wed, 06 Jul 2011 13:43:35 GMT</pubDate></item><item><title>Manu commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>Also, can someone elaborate why "Log and throw" is an anti-pattern? In my opinion all exceptions that are not handled explicitly otherwise should be logged and thrown.</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment17</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment17</guid><pubDate>Wed, 06 Jul 2011 13:41:45 GMT</pubDate></item><item><title>Manu commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>Clearly this code was generated by some script. It is of course a most embarrassing violation of (among many) the DRY principle.</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment16</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment16</guid><pubDate>Wed, 06 Jul 2011 13:38:09 GMT</pubDate></item><item><title>Mani commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>Shocking!!</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment15</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment15</guid><pubDate>Wed, 06 Jul 2011 13:31:45 GMT</pubDate></item><item><title>tobi commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>I am deeply disturbed by the fact that they are catching ArgumentException, thereby suppressing potential bugs. What a disgrace.</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment14</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment14</guid><pubDate>Wed, 06 Jul 2011 13:31:34 GMT</pubDate></item><item><title>Belvasis commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>The real problem is, that a lot of people will adopt this "guidance" in their real world projects, because if MS says it is good and proven practice...it must be correct.</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment13</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment13</guid><pubDate>Wed, 06 Jul 2011 12:34:24 GMT</pubDate></item><item><title>Dmytrii Nagirniak commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>My appologies but that is so fucking ridiculous. How could it possible be ah guidance!!

That's just a fucking joke.
I wonder when people will stop doing stupid "practices" and actually start doing something useful.

One more time, my apologies for the language, but it is a kind scream from the soul :)</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment12</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment12</guid><pubDate>Wed, 06 Jul 2011 11:31:25 GMT</pubDate></item><item><title>Ayende Rahien commented on Review: Microsoft N Layer App Sample, Part V&amp;ndash;Cross Cutting is a fine line</title><description>Christian,
You might want to look at my github profile, specifically, Alexandria might be a good candidate.
</description><link>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment11</link><guid>http://ayende.com/30721/review-microsoft-n-layer-app-sample-part-v-cross-cutting-is-a-fine-line#comment11</guid><pubDate>Wed, 06 Jul 2011 11:21:48 GMT</pubDate></item></channel></rss>