﻿<?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>Ayende Rahien commented on There are so many things wrong with this code…</title><description>Brian,
  
Sort of my point
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment57</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment57</guid><pubDate>Sat, 02 May 2009 06:30:54 GMT</pubDate></item><item><title>Brian Henderson commented on There are so many things wrong with this code…</title><description>How to make this code throw an exception?  Would like to see an unit test that demonstrates. Thx.
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment56</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment56</guid><pubDate>Sat, 02 May 2009 06:28:38 GMT</pubDate></item><item><title>Sung Meister commented on There are so many things wrong with this code…</title><description>It has now been deleted... I can't get myself into context any more.
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment55</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment55</guid><pubDate>Mon, 27 Apr 2009 03:12:33 GMT</pubDate></item><item><title>Ayende Rahien commented on There are so many things wrong with this code…</title><description>Aslam,
  
Several reasons:
  
a) bad code need to be made public, to make sure that people _recognize it as bad code
  
b) this is actually fairly high on the search for a few important nhibernate concurrency searches
  
  
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment54</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment54</guid><pubDate>Tue, 21 Apr 2009 07:34:22 GMT</pubDate></item><item><title>Pop Catalin commented on There are so many things wrong with this code…</title><description>&gt; Well it seems that your criticism of the author has now caused the article to be removed.. 
  
  
It's a shame, that the criticism didn't make the author rewrite it ...
  
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment53</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment53</guid><pubDate>Fri, 17 Apr 2009 14:49:40 GMT</pubDate></item><item><title>Jeff Hadfield commented on There are so many things wrong with this code…</title><description>It's already been voted into oblivion by the community. Hooray. Thanks for reading The Code Project, though. Hope you voted it down!
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment52</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment52</guid><pubDate>Thu, 16 Apr 2009 23:14:41 GMT</pubDate></item><item><title>Green WIlliams commented on There are so many things wrong with this code…</title><description>I have an idea. Let me throw up  lousy code, lay back and watch herds of women-deprived geeks laugh about it and throw up more code. Oh, no need to. It has already been done here. 
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment51</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment51</guid><pubDate>Thu, 16 Apr 2009 18:58:22 GMT</pubDate></item><item><title>Moran commented on There are so many things wrong with this code…</title><description>I've seen much worse:
  
try { ... } 
  
catch(Exception ex) 
  
{ 
  
Response.Write(ex.Message + "
  
" + ex.StackTrace);
  
}
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment50</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment50</guid><pubDate>Thu, 16 Apr 2009 13:32:41 GMT</pubDate></item><item><title>Dave G commented on There are so many things wrong with this code…</title><description>Well it seems that your criticism of the author has now caused the article to be removed..
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment49</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment49</guid><pubDate>Wed, 15 Apr 2009 20:22:06 GMT</pubDate></item><item><title>Dmitry commented on There are so many things wrong with this code…</title><description>The method actually returns a copy of the reference. .NET uses a copy of the original reference inside a method unless the "ref" keyword is used in the parameter declaration. This is why setting the reference to null inside the method will not change the outside reference.
  
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment48</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment48</guid><pubDate>Wed, 15 Apr 2009 13:53:03 GMT</pubDate></item><item><title>Leo commented on There are so many things wrong with this code…</title><description>Thanks Ayende. That was quick. I am glad you restored my sanity.
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment47</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment47</guid><pubDate>Wed, 15 Apr 2009 11:59:59 GMT</pubDate></item><item><title>Ayende Rahien commented on There are so many things wrong with this code…</title><description>throw; // keep the stack trace
  
throw ex; // lose the stack trace
  
  
Losing the stack trace is _bad_.
  
  
Putting a try catch block without doing any error handling is wrong. 
  
  
DeepCopy should perform a DEEP copy, not a ref copy.
  
What this method does is return the same reference, so it lies about its impl.
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment46</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment46</guid><pubDate>Wed, 15 Apr 2009 11:49:24 GMT</pubDate></item><item><title>Leo commented on There are so many things wrong with this code…</title><description>guys.,
  
I am one of those junior developers who can't see what is so wrong with the code. How would it be different if one would do
  
Catch(Exception ex)
  
{ throw; }
  
  
In the case of the author he is still throwing eventually. I miss the point.
  
  
Also I am not sure what are the inherent problems with accepting a parameter as an object and then returning it? Let me go further and say I don't even understand how does that mean deep copy? Just accepting an object by reference and returning the reference back.
  
I would be glad for any pointers. 
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment45</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment45</guid><pubDate>Wed, 15 Apr 2009 11:44:17 GMT</pubDate></item><item><title>Alex commented on There are so many things wrong with this code…</title><description>I call fizzbuzz.
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment44</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment44</guid><pubDate>Wed, 15 Apr 2009 03:26:30 GMT</pubDate></item><item><title>Krylen commented on There are so many things wrong with this code…</title><description>Wow, that's something else right there. The creator of that code should give this new fangled learning technique called "reading books" a try.
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment43</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment43</guid><pubDate>Tue, 14 Apr 2009 23:37:16 GMT</pubDate></item><item><title>Peter Morris commented on There are so many things wrong with this code…</title><description>@Grunties : What good reasons are those?
  
  
@Aslam : If you are going to compare with something, try something that people have heard of :-)
  
  
Seriously though, I thought this post was a bit pathetic until I saw the author's apparent inability to accept his mistakes and fix the code in the article.  *Then* I thought the article was worth mocking.
  
  
It's counts not only how good you are when things go right, but also how good you are when things go wrong!
  
  
If my code is shit I will be glad for the criticism as I learn from changing it.
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment42</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment42</guid><pubDate>Tue, 14 Apr 2009 21:38:10 GMT</pubDate></item><item><title>Tim commented on There are so many things wrong with this code…</title><description>Shame on CodeProject.com. 
  
  
I'll be extra skeptical next time I see a CodeProject article from an unknown author.
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment41</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment41</guid><pubDate>Tue, 14 Apr 2009 17:42:54 GMT</pubDate></item><item><title>Stinking Machines commented on There are so many things wrong with this code…</title><description>It looks like a stub.  Move along...
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment40</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment40</guid><pubDate>Tue, 14 Apr 2009 16:28:48 GMT</pubDate></item><item><title>Scott R commented on There are so many things wrong with this code…</title><description>i haven't laughed so hard in ages. thank you for brightening my day.
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment39</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment39</guid><pubDate>Tue, 14 Apr 2009 16:02:46 GMT</pubDate></item><item><title>James E. Ervin commented on There are so many things wrong with this code…</title><description>There is nothing wrong with the code, that is just it, there is nothing.  It makes me feel almost zen like... There is nothing wrong... There is no spoon... There is no special ingredient... There is just nothing....
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment38</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment38</guid><pubDate>Tue, 14 Apr 2009 15:49:02 GMT</pubDate></item><item><title>Fabio Maulo commented on There are so many things wrong with this code…</title><description>Probably you don't have realized that the NH's users generation are changing; this is not a minor problem and sure it is a problem.
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment37</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment37</guid><pubDate>Tue, 14 Apr 2009 14:58:40 GMT</pubDate></item><item><title>Min commented on There are so many things wrong with this code…</title><description>Wow...
  
  
I do not know what disturbs me more, the fact that this article was accepted by CodeProject or the fact that someone out there will use this article in production code.
  
  
I've googled some of the code in my company's codebase and have found some CodeProject articles come up.
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment36</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment36</guid><pubDate>Tue, 14 Apr 2009 14:09:01 GMT</pubDate></item><item><title>Matt H commented on There are so many things wrong with this code…</title><description>maybe the code was poorly ported from C++ where the object was returned by value and the exception was caught in case the copy constructor failed
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment35</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment35</guid><pubDate>Tue, 14 Apr 2009 13:36:56 GMT</pubDate></item><item><title>Aslam Khan commented on There are so many things wrong with this code…</title><description>Yes, this is just bad code.  Ayende has rightfully surfaced it as such.  But I really don't see the value of hosing the author as a useless developer.  Have you asked yourself "Why am I laughing at this - publicly, and loudly?".
  
  
I watched the tail-end of Romy and Michelle's High School Reunion on TV last night.  The laugh comments here reminds me of Christine and her girlfriends ridiculing Romy and Michele at the reunion.
  
  
I think we are all capable of being better people than this.
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment34</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment34</guid><pubDate>Tue, 14 Apr 2009 13:22:00 GMT</pubDate></item><item><title>Pop Catalin commented on There are so many things wrong with this code…</title><description>@Grunties, I don' claim to be a smart fellow or an enlightened .Net developer, but what are the reasons you are talking about?
  
  
This is not about elitism, this is about spreading bad coding practices, in a community where thousands of developers passionate about their framework and language invest huge amounts of time and dedication to write blog posts, articles and books about good coding practices as a community effort to raise the quality bar of the code .Net developers write in general.
  
  
We are all better of when bad coding isn't spread around in articles like this one.
  
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment33</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment33</guid><pubDate>Tue, 14 Apr 2009 12:19:10 GMT</pubDate></item><item><title>John Chapman commented on There are so many things wrong with this code…</title><description>Why did you leave out the Disassemble method?  It really ties the whole thing together.  I actually feel kind of bad for him, but worse for the people reading this as an expert example.
  
  
public object DeepCopy(object value)
  
        {
  
            try
  
            {
  
                return value;
  
            }
  
            catch (Exception ex)
  
            {
  
                throw ex;
  
            }
  
        }
  
        public object Disassemble(object value)
  
        {
  
            try
  
            {
  
                return DeepCopy(value);
  
            }
  
            catch (Exception ex)
  
            {
  
                throw ex;
  
            }
  
        }
  
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment32</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment32</guid><pubDate>Tue, 14 Apr 2009 12:13:06 GMT</pubDate></item><item><title>jay vaughan commented on There are so many things wrong with this code…</title><description>// tl;dr
  
duh, everyone knows that this is just a hook for an out-of-VM exception handler. 
  
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment31</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment31</guid><pubDate>Tue, 14 Apr 2009 11:54:55 GMT</pubDate></item><item><title>Grunties commented on There are so many things wrong with this code…</title><description>There's some things wrong with this code, yes, and it was clearly written by someone with little understanding of what's going on 'under the bonnet/hood'. But, here, there's a lot of Dunning-Kruger effect. There are some good reasons to be doing what this code is attempting, and yet no one here wants to mention any of it. Shameful and misguided elitism, IMHO.
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment30</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment30</guid><pubDate>Tue, 14 Apr 2009 11:37:14 GMT</pubDate></item><item><title>Chris commented on There are so many things wrong with this code…</title><description>BRILLANT
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment29</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment29</guid><pubDate>Tue, 14 Apr 2009 11:08:40 GMT</pubDate></item><item><title>defaultuser commented on There are so many things wrong with this code…</title><description>PERFECT :)
</description><link>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment28</link><guid>http://ayende.com/3944/there-are-so-many-things-wrong-with-this-code#comment28</guid><pubDate>Tue, 14 Apr 2009 10:18:29 GMT</pubDate></item></channel></rss>