<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: I need some peer review on this</title>
	<atom:link href="http://lostechies.com/chadmyers/2009/05/05/i-need-some-peer-review-on-this/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/chadmyers/2009/05/05/i-need-some-peer-review-on-this/</link>
	<description>Software development, testing, and techie life</description>
	<lastBuildDate>Thu, 08 Mar 2012 22:19:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: David Nelson</title>
		<link>http://lostechies.com/chadmyers/2009/05/05/i-need-some-peer-review-on-this/#comment-987</link>
		<dc:creator>David Nelson</dc:creator>
		<pubDate>Fri, 08 May 2009 16:14:44 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2009/05/05/i-need-some-peer-review-on-this.aspx#comment-987</guid>
		<description>&quot;Throwing and catching a lot of exceptions is just bad coding unless there is no other alternative.&quot;

In principle I agree. But in this case, it isn&#039;t your code that is throwing the exceptions; you are simply being forced into the position of catching them by someone else&#039;s bad design. Refusing to call code that you know will throw an exception simply because you don&#039;t consider the circumstance exceptional - when the only alternative is complex, difficult to maintain, and very unlikely to be 100% effective - doesn&#039;t make much sense to me.</description>
		<content:encoded><![CDATA[<p>&#8220;Throwing and catching a lot of exceptions is just bad coding unless there is no other alternative.&#8221;</p>
<p>In principle I agree. But in this case, it isn&#8217;t your code that is throwing the exceptions; you are simply being forced into the position of catching them by someone else&#8217;s bad design. Refusing to call code that you know will throw an exception simply because you don&#8217;t consider the circumstance exceptional &#8211; when the only alternative is complex, difficult to maintain, and very unlikely to be 100% effective &#8211; doesn&#8217;t make much sense to me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Chiasson</title>
		<link>http://lostechies.com/chadmyers/2009/05/05/i-need-some-peer-review-on-this/#comment-986</link>
		<dc:creator>Brian Chiasson</dc:creator>
		<pubDate>Wed, 06 May 2009 13:23:30 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2009/05/05/i-need-some-peer-review-on-this.aspx#comment-986</guid>
		<description>@Chad

I was thinking more along the lines of an Interface definition or base class, versus the &quot;typical&quot; (lack of better word) constraints.

I am guessing that you already considered taking the &quot;reflection hit&quot; the first time the request is made to the specific TAI as opposed to loading them all at once?</description>
		<content:encoded><![CDATA[<p>@Chad</p>
<p>I was thinking more along the lines of an Interface definition or base class, versus the &#8220;typical&#8221; (lack of better word) constraints.</p>
<p>I am guessing that you already considered taking the &#8220;reflection hit&#8221; the first time the request is made to the specific TAI as opposed to loading them all at once?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chadmyers</title>
		<link>http://lostechies.com/chadmyers/2009/05/05/i-need-some-peer-review-on-this/#comment-985</link>
		<dc:creator>chadmyers</dc:creator>
		<pubDate>Wed, 06 May 2009 06:48:37 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2009/05/05/i-need-some-peer-review-on-this.aspx#comment-985</guid>
		<description>@Chris: I&#039;m looping through and discovering all the &quot;Controller&quot; types in a given assembly, then finding any candidate methods that would be &quot;Actions&quot;,  and then configuring a ThunderdomeActionInvoker (heretofore TAI) in StructureMap to invoke those actions.

I do the nasty reflection business at startup and then configure generic, properly-typed invokers and things to avoid the reflection hit every single request to every single action.

</description>
		<content:encoded><![CDATA[<p>@Chris: I&#8217;m looping through and discovering all the &#8220;Controller&#8221; types in a given assembly, then finding any candidate methods that would be &#8220;Actions&#8221;,  and then configuring a ThunderdomeActionInvoker (heretofore TAI) in StructureMap to invoke those actions.</p>
<p>I do the nasty reflection business at startup and then configure generic, properly-typed invokers and things to avoid the reflection hit every single request to every single action.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Tavares</title>
		<link>http://lostechies.com/chadmyers/2009/05/05/i-need-some-peer-review-on-this/#comment-984</link>
		<dc:creator>Chris Tavares</dc:creator>
		<pubDate>Wed, 06 May 2009 06:33:22 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2009/05/05/i-need-some-peer-review-on-this.aspx#comment-984</guid>
		<description>Stupid question department, probably, but my guess is the ActionInvoker class is doing a ton of reflection. If it&#039;s doing reflection anyway, why is it generic at all? Are you actually saving anything performance wise or gaining anything by using the generic type arguments?

</description>
		<content:encoded><![CDATA[<p>Stupid question department, probably, but my guess is the ActionInvoker class is doing a ton of reflection. If it&#8217;s doing reflection anyway, why is it generic at all? Are you actually saving anything performance wise or gaining anything by using the generic type arguments?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chadmyers</title>
		<link>http://lostechies.com/chadmyers/2009/05/05/i-need-some-peer-review-on-this/#comment-983</link>
		<dc:creator>chadmyers</dc:creator>
		<pubDate>Tue, 05 May 2009 20:50:52 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2009/05/05/i-need-some-peer-review-on-this.aspx#comment-983</guid>
		<description>@David:

I&#039;m looping over the types anyhow, no need to make the situation worse by adding a bunch of exceptions to the mix.

Exceptions are, by definition, exceptional. This is not an exceptional case. These are normal types that may or may not  meet certain criteria I need.

Throwing and catching a lot of exceptions is just bad coding unless there is no other alternative.</description>
		<content:encoded><![CDATA[<p>@David:</p>
<p>I&#8217;m looping over the types anyhow, no need to make the situation worse by adding a bunch of exceptions to the mix.</p>
<p>Exceptions are, by definition, exceptional. This is not an exceptional case. These are normal types that may or may not  meet certain criteria I need.</p>
<p>Throwing and catching a lot of exceptions is just bad coding unless there is no other alternative.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Nelson</title>
		<link>http://lostechies.com/chadmyers/2009/05/05/i-need-some-peer-review-on-this/#comment-982</link>
		<dc:creator>David Nelson</dc:creator>
		<pubDate>Tue, 05 May 2009 19:02:14 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2009/05/05/i-need-some-peer-review-on-this.aspx#comment-982</guid>
		<description>&quot;Catching exceptions is bad because I&#039;ll be running this on potentially dozens or hundreds of types and that level of exception throwing/catching is unacceptable in my book.&quot;

I am curious as to why this is automatically unacceptable. Is it because of the potential performance problem? Because I am not sure that doing extensive reflection on the types is going to be any better. And I certainly wouldn&#039;t go down the much more complicated way until I had at least tried the simple way to see if it feel within my requirements.</description>
		<content:encoded><![CDATA[<p>&#8220;Catching exceptions is bad because I&#8217;ll be running this on potentially dozens or hundreds of types and that level of exception throwing/catching is unacceptable in my book.&#8221;</p>
<p>I am curious as to why this is automatically unacceptable. Is it because of the potential performance problem? Because I am not sure that doing extensive reflection on the types is going to be any better. And I certainly wouldn&#8217;t go down the much more complicated way until I had at least tried the simple way to see if it feel within my requirements.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chadmyers</title>
		<link>http://lostechies.com/chadmyers/2009/05/05/i-need-some-peer-review-on-this/#comment-981</link>
		<dc:creator>chadmyers</dc:creator>
		<pubDate>Tue, 05 May 2009 17:18:31 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2009/05/05/i-need-some-peer-review-on-this.aspx#comment-981</guid>
		<description>@Brian:

At least in this specific case, I&#039;ve already checked to make sure that TInput is not an open generic type  (i.e. Foo&lt;String&gt; is ok, but Foo&lt;T&gt; is not).

If we add another constraint to TInput (such as replacing &#039;class&#039; with &#039;struct&#039;), this code I posted should handle it fine.</description>
		<content:encoded><![CDATA[<p>@Brian:</p>
<p>At least in this specific case, I&#8217;ve already checked to make sure that TInput is not an open generic type  (i.e. Foo<string> is ok, but Foo<t> is not).</p>
<p>If we add another constraint to TInput (such as replacing &#8216;class&#8217; with &#8216;struct&#8217;), this code I posted should handle it fine.</t></string></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Chiasson</title>
		<link>http://lostechies.com/chadmyers/2009/05/05/i-need-some-peer-review-on-this/#comment-980</link>
		<dc:creator>Brian Chiasson</dc:creator>
		<pubDate>Tue, 05 May 2009 13:56:36 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2009/05/05/i-need-some-peer-review-on-this.aspx#comment-980</guid>
		<description>Some more thoughts...

You or your team have to remember this method if you add another constraint on TInput.

Can TInput be generic? If TInput can be generic, will it ever be open when you attempt to create the invoker?
</description>
		<content:encoded><![CDATA[<p>Some more thoughts&#8230;</p>
<p>You or your team have to remember this method if you add another constraint on TInput.</p>
<p>Can TInput be generic? If TInput can be generic, will it ever be open when you attempt to create the invoker?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chadmyers</title>
		<link>http://lostechies.com/chadmyers/2009/05/05/i-need-some-peer-review-on-this/#comment-979</link>
		<dc:creator>chadmyers</dc:creator>
		<pubDate>Tue, 05 May 2009 13:53:15 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2009/05/05/i-need-some-peer-review-on-this.aspx#comment-979</guid>
		<description>Rasmus,

Yes, I do need it :)   Catching exceptions is bad because I&#039;ll be running this on potentially dozens or hundreds of types and that level of exception throwing/catching is unacceptable in my book.

The problem is I have an open generic type and I have candidate types to fill in the generic parameters.  This is all via reflection, so I don&#039;t have direct knowledge of the types, only their Type/reflection metadata.

I need to see if Type X will work as the &quot;TInput&quot; for &quot;FooType&lt;TInput&gt; where TInput : class, new()&quot;

The only way I can see this in the BCL is to try calling MakeGenericType() and hope for the best. This is unacceptable, so I&#039;m trying to evaluate the condition before blindly calling an exception-throwing method.</description>
		<content:encoded><![CDATA[<p>Rasmus,</p>
<p>Yes, I do need it :)   Catching exceptions is bad because I&#8217;ll be running this on potentially dozens or hundreds of types and that level of exception throwing/catching is unacceptable in my book.</p>
<p>The problem is I have an open generic type and I have candidate types to fill in the generic parameters.  This is all via reflection, so I don&#8217;t have direct knowledge of the types, only their Type/reflection metadata.</p>
<p>I need to see if Type X will work as the &#8220;TInput&#8221; for &#8220;FooType<tinput> where TInput : class, new()&#8221;</p>
<p>The only way I can see this in the BCL is to try calling MakeGenericType() and hope for the best. This is unacceptable, so I&#8217;m trying to evaluate the condition before blindly calling an exception-throwing method.</tinput></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Chiasson</title>
		<link>http://lostechies.com/chadmyers/2009/05/05/i-need-some-peer-review-on-this/#comment-978</link>
		<dc:creator>Brian Chiasson</dc:creator>
		<pubDate>Tue, 05 May 2009 13:23:28 +0000</pubDate>
		<guid isPermaLink="false">/blogs/chad_myers/archive/2009/05/05/i-need-some-peer-review-on-this.aspx#comment-978</guid>
		<description>Okay, so I didn&#039;t totally GROK the problem, but now I get it and you have sent me off on a tangent that has cost me some time this morning. 

From what I can tell, based on the BCL, poking around in Reflector, and Google, you have to do the constraint checking yourself.</description>
		<content:encoded><![CDATA[<p>Okay, so I didn&#8217;t totally GROK the problem, but now I get it and you have sent me off on a tangent that has cost me some time this morning. </p>
<p>From what I can tell, based on the BCL, poking around in Reflector, and Google, you have to do the constraint checking yourself.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
