<?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: Alternative to abusing using</title>
	<atom:link href="http://jagregory.com/writings/alternative-to-abusing-using/feed/" rel="self" type="application/rss+xml" />
	<link>http://jagregory.com/writings/alternative-to-abusing-using/</link>
	<description>Monkeying with the code</description>
	<lastBuildDate>Thu, 04 Aug 2011 15:17:48 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
	<item>
		<title>By: James Gregory</title>
		<link>http://jagregory.com/writings/alternative-to-abusing-using/comment-page-1/#comment-12030</link>
		<dc:creator>James Gregory</dc:creator>
		<pubDate>Thu, 09 Oct 2008 08:39:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=107#comment-12030</guid>
		<description>You make some good points. Your performance argument is interesting, and I&#039;d like to subscribe to your newsletter. It certainly is something to bare in mind, at the very least in a &quot;I&#039;ll remember that idea for later so I can save the day&quot; way. ;)</description>
		<content:encoded><![CDATA[<p>You make some good points. Your performance argument is interesting, and I&#8217;d like to subscribe to your newsletter. It certainly is something to bare in mind, at the very least in a &#8220;I&#8217;ll remember that idea for later so I can save the day&#8221; way. <img src='http://jagregory.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Gray</title>
		<link>http://jagregory.com/writings/alternative-to-abusing-using/comment-page-1/#comment-11989</link>
		<dc:creator>Jeremy Gray</dc:creator>
		<pubDate>Wed, 08 Oct 2008 17:14:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=107#comment-11989</guid>
		<description>@James - agreed in general on all points, with perhaps a few nits to pick. :)

Regarding debugging, it isn&#039;t you are I that I am worried about. ;) Not every developer on my team has the same level of experience, however, hence some of my concern.

Regarding perf, I do agree with you that there are far bigger fish to fry but one problem that can come up with approaches like these (and the disposable approach presents similar possible issues) is that if they are going to hurt your perf they are going to do it in a way that is often spread quite widely across your app, but in tiny increments in each location. It is as if the entire app drags a bit, and since it drags the whole app equally (assuming you&#039;ve used these mechanisms in enough places to have them being hit across a large percentage of application usage) it can be hard to diagnose and correct the issue because it won&#039;t reveal a clear hotspot in a profile. Harder, at least, than killing the worst hotspot and moving onto the next one. Now, that&#039;s not to suggest that this is even remotely insurmountable, of course. Rather just to say that one needs to keep a slightly different kind of lookout for the effects of mechanisms like these because they can drag the app down a bit differently than most normal perf issues do. I mention it only because I&#039;ve seen people with reasonable amounts of experience and a profiler in hand still miss this kind of issue, that&#039;s all. :)

In any case, thanks for the post and the kind exchange of commentary!</description>
		<content:encoded><![CDATA[<p>@James &#8211; agreed in general on all points, with perhaps a few nits to pick. <img src='http://jagregory.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Regarding debugging, it isn&#8217;t you are I that I am worried about. <img src='http://jagregory.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Not every developer on my team has the same level of experience, however, hence some of my concern.</p>
<p>Regarding perf, I do agree with you that there are far bigger fish to fry but one problem that can come up with approaches like these (and the disposable approach presents similar possible issues) is that if they are going to hurt your perf they are going to do it in a way that is often spread quite widely across your app, but in tiny increments in each location. It is as if the entire app drags a bit, and since it drags the whole app equally (assuming you&#8217;ve used these mechanisms in enough places to have them being hit across a large percentage of application usage) it can be hard to diagnose and correct the issue because it won&#8217;t reveal a clear hotspot in a profile. Harder, at least, than killing the worst hotspot and moving onto the next one. Now, that&#8217;s not to suggest that this is even remotely insurmountable, of course. Rather just to say that one needs to keep a slightly different kind of lookout for the effects of mechanisms like these because they can drag the app down a bit differently than most normal perf issues do. I mention it only because I&#8217;ve seen people with reasonable amounts of experience and a profiler in hand still miss this kind of issue, that&#8217;s all. <img src='http://jagregory.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>In any case, thanks for the post and the kind exchange of commentary!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Gregory</title>
		<link>http://jagregory.com/writings/alternative-to-abusing-using/comment-page-1/#comment-11966</link>
		<dc:creator>James Gregory</dc:creator>
		<pubDate>Wed, 08 Oct 2008 07:55:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=107#comment-11966</guid>
		<description>@Jeremy: Thanks for the comments. I’m not concerned by your concerns, but that doesn’t mean they aren’t valid!

I’ve not had any trouble with debugging lambdas, and Fluent NHibernate is pretty heavy in them. Maybe I’ve got it yet to come…

Regarding performance, I never worry about it when it comes to syntax. The implications of using lambdas on performance will be so negligible compared to a badly written DB query, or IO operations, it’s not even worth thinking about. Unless somebody can prove to me there is a significant performance loss (and I’m talking seconds, not microseconds), then I’m not worried.</description>
		<content:encoded><![CDATA[<p>@Jeremy: Thanks for the comments. I’m not concerned by your concerns, but that doesn’t mean they aren’t valid!</p>
<p>I’ve not had any trouble with debugging lambdas, and Fluent NHibernate is pretty heavy in them. Maybe I’ve got it yet to come…</p>
<p>Regarding performance, I never worry about it when it comes to syntax. The implications of using lambdas on performance will be so negligible compared to a badly written DB query, or IO operations, it’s not even worth thinking about. Unless somebody can prove to me there is a significant performance loss (and I’m talking seconds, not microseconds), then I’m not worried.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Gray</title>
		<link>http://jagregory.com/writings/alternative-to-abusing-using/comment-page-1/#comment-11954</link>
		<dc:creator>Jeremy Gray</dc:creator>
		<pubDate>Wed, 08 Oct 2008 04:42:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=107#comment-11954</guid>
		<description>I definitely feel your pain, and have found myself recently implementing the lambda-style replacements to see how they would hold up, and I gotta tell ya that I&#039;m torn on the issue and almost tempted to head back to the using style. I have two primary concerns with the lambda-based approach (syntactical weirdness for some developers aside for the moment.)

1. (and this is the biggie, as far as I&#039;m concerned) stack trace obfuscation. There&#039;s nothing like seeing a tonne of anonymous classes and their methods popping up all over your stack traces to send someone running for the hills when trying to diagnose an issue in lambda-heavy code.

2. Perf overhead. When the pedal needs to hit the metal, I suspect that a compiler-inserted try/finally with a dispose call in the finally is going to destroy the anonymous class instantiation / delegate invocation perf-wise. Admittedly, I have no numbers to back this up at this point as I am fundamentally more concerned about issue #1 at the moment, but the potential perf issue is there nagging me in the back of my mind. Has anyone compared perf, I wonder?</description>
		<content:encoded><![CDATA[<p>I definitely feel your pain, and have found myself recently implementing the lambda-style replacements to see how they would hold up, and I gotta tell ya that I&#8217;m torn on the issue and almost tempted to head back to the using style. I have two primary concerns with the lambda-based approach (syntactical weirdness for some developers aside for the moment.)</p>
<p>1. (and this is the biggie, as far as I&#8217;m concerned) stack trace obfuscation. There&#8217;s nothing like seeing a tonne of anonymous classes and their methods popping up all over your stack traces to send someone running for the hills when trying to diagnose an issue in lambda-heavy code.</p>
<p>2. Perf overhead. When the pedal needs to hit the metal, I suspect that a compiler-inserted try/finally with a dispose call in the finally is going to destroy the anonymous class instantiation / delegate invocation perf-wise. Admittedly, I have no numbers to back this up at this point as I am fundamentally more concerned about issue #1 at the moment, but the potential perf issue is there nagging me in the back of my mind. Has anyone compared perf, I wonder?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Gregory</title>
		<link>http://jagregory.com/writings/alternative-to-abusing-using/comment-page-1/#comment-11934</link>
		<dc:creator>James Gregory</dc:creator>
		<pubDate>Tue, 07 Oct 2008 21:33:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=107#comment-11934</guid>
		<description>That&#039;s one of the few things that annoys me about lambdas in C#, they remind me of Ruby and it&#039;s much better syntax!</description>
		<content:encoded><![CDATA[<p>That&#8217;s one of the few things that annoys me about lambdas in C#, they remind me of Ruby and it&#8217;s much better syntax!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Avish</title>
		<link>http://jagregory.com/writings/alternative-to-abusing-using/comment-page-1/#comment-11932</link>
		<dc:creator>Avish</dc:creator>
		<pubDate>Tue, 07 Oct 2008 21:23:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=107#comment-11932</guid>
		<description>I never liked the fact that the using keyword is the only way to declare custom &quot;scopes&quot;, and that you have to use Dispose to perform end-of-scope actions. But I agree that it&#039;s better than nothing.

Your solution is actually the exact solution ruby uses as one of its main idioms -- except in ruby, lambda syntax is even more readable because of adjacent lambda parameters and the do..end syntax:

File.OpenRead(&quot;myFile.txt&quot;) do &#124;file&#124;
   # do something with the file  
end

And, of course, there&#039;s Boo to the rescue with its own flavor of the same thing:

File.OpenRead(&quot;myFile.txt&quot;) do(file):
  // do something with the file
end

Which, combined with meta methods and parentheses-less invocations, means you can make your scopes work their magic at compile time rather than at runtime, which really allows freedom in declaring custom scopes.</description>
		<content:encoded><![CDATA[<p>I never liked the fact that the using keyword is the only way to declare custom &#8220;scopes&#8221;, and that you have to use Dispose to perform end-of-scope actions. But I agree that it&#8217;s better than nothing.</p>
<p>Your solution is actually the exact solution ruby uses as one of its main idioms &#8212; except in ruby, lambda syntax is even more readable because of adjacent lambda parameters and the do..end syntax:</p>
<p>File.OpenRead(&#8220;myFile.txt&#8221;) do |file|<br />
   # do something with the file<br />
end</p>
<p>And, of course, there&#8217;s Boo to the rescue with its own flavor of the same thing:</p>
<p>File.OpenRead(&#8220;myFile.txt&#8221;) do(file):<br />
  // do something with the file<br />
end</p>
<p>Which, combined with meta methods and parentheses-less invocations, means you can make your scopes work their magic at compile time rather than at runtime, which really allows freedom in declaring custom scopes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Gregory</title>
		<link>http://jagregory.com/writings/alternative-to-abusing-using/comment-page-1/#comment-11930</link>
		<dc:creator>James Gregory</dc:creator>
		<pubDate>Tue, 07 Oct 2008 20:23:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=107#comment-11930</guid>
		<description>That&#039;s a fair point. To me personally, it&#039;s more readable, but perhaps to the average dev it isn&#039;t.

With the proliferation of lambdas in frameworks, I&#039;d hope that they&#039;ll move into the collective developer consciousness before too long.

Ignoring the regular developer tax for a moment, I still believe the using statement itself is redundant in most of the non-disposable usages of it. We&#039;ve come to ignore it in most cases. using (mocks.Record()) doesn&#039;t really make sense when you read it, but mocks.Record(() =&gt;) does.</description>
		<content:encoded><![CDATA[<p>That&#8217;s a fair point. To me personally, it&#8217;s more readable, but perhaps to the average dev it isn&#8217;t.</p>
<p>With the proliferation of lambdas in frameworks, I&#8217;d hope that they&#8217;ll move into the collective developer consciousness before too long.</p>
<p>Ignoring the regular developer tax for a moment, I still believe the using statement itself is redundant in most of the non-disposable usages of it. We&#8217;ve come to ignore it in most cases. using (mocks.Record()) doesn&#8217;t really make sense when you read it, but mocks.Record(() =>) does.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Console colours wrapper &#8212; James Gregory</title>
		<link>http://jagregory.com/writings/alternative-to-abusing-using/comment-page-1/#comment-11928</link>
		<dc:creator>Console colours wrapper &#8212; James Gregory</dc:creator>
		<pubDate>Tue, 07 Oct 2008 19:58:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=107#comment-11928</guid>
		<description>[...] &#8592; Alternative to abusing using [...]</description>
		<content:encoded><![CDATA[<p>[...] &larr; Alternative to abusing using [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derik Whittaker</title>
		<link>http://jagregory.com/writings/alternative-to-abusing-using/comment-page-1/#comment-11927</link>
		<dc:creator>Derik Whittaker</dc:creator>
		<pubDate>Tue, 07 Oct 2008 19:55:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jagregory.com/?p=107#comment-11927</guid>
		<description>Personally i like where u are going with this.  However, I think the using statement is easier to read.

Your statement &#039;No more unclear “using”&#039; to me is false.  Lambda&#039;s are much harder to read/understand for the average developer.</description>
		<content:encoded><![CDATA[<p>Personally i like where u are going with this.  However, I think the using statement is easier to read.</p>
<p>Your statement &#8216;No more unclear “using”&#8217; to me is false.  Lambda&#8217;s are much harder to read/understand for the average developer.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
