<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-6800934446457898793.post3697554272614582724..comments</id><updated>2010-07-04T08:46:25.456-04:00</updated><category term='trueskill'/><category term='aes'/><title type='text'>Comments on Moserware: Boy Scout Check-ins</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.moserware.com/feeds/3697554272614582724/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html'/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_Zfbv3mHcYrc/SLDM--5fn8I/AAAAAAAAA1w/EZtLwWvYhdI/S220/facebook+beard2.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-6408230989118190876</id><published>2008-11-23T16:54:00.000-05:00</published><updated>2008-11-23T16:54:00.000-05:00</updated><title type='text'>Mark Miller: it's a good point you mentioned that ...</title><content type='html'>Mark Miller: it's a good point you mentioned that things evolve over time. This perhaps makes it even more important to do Boy Scout Check-ins. You might have done something in a not-as-clear way in the past to work around a limitation. Thankfully, the most obvious/clear way is typically optimized later. Within reason, optimize for clarity and then let the tools catch up :)&lt;BR/&gt;&lt;BR/&gt;Elaine: It's painful; I've been there. People don't want to make even tiny improvements for fear that their name will be the last edit on a file (and thus responsible for bug fixes). This cultures seems to kill the fun from and the code quality deteriorates... forcing a mediocre code and programmers feeling like their in a tar pit.&lt;BR/&gt;&lt;BR/&gt;Hopefully your new job has a better culture? :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/6408230989118190876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/6408230989118190876'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html?showComment=1227477240000#c6408230989118190876' title=''/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_Zfbv3mHcYrc/SLDM--5fn8I/AAAAAAAAA1w/EZtLwWvYhdI/S220/facebook+beard2.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-3697554272614582724' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/3697554272614582724' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-252333216'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-5104693166212538263</id><published>2008-11-23T15:34:00.000-05:00</published><updated>2008-11-23T15:34:00.000-05:00</updated><title type='text'>Good topic, Jeff.&lt;br&gt;&lt;br&gt;At my last place of devel...</title><content type='html'>Good topic, Jeff.&lt;BR/&gt;&lt;BR/&gt;At my last place of development, we were told *NOT* to change anything outside specifically what we were told to change.  Why?  Because you didn't want "ownership" of the code if it didn't apply to the changes (and case number) you were making.&lt;BR/&gt;&lt;BR/&gt;It got to the point where some entire systems needed to be rewritten (some code dating back to the early '80's) because no one knew what the hell was going on -- they only knew what went in and what came out.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/5104693166212538263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/5104693166212538263'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html?showComment=1227472440000#c5104693166212538263' title=''/><author><name>Elaine</name><uri>http://www.blogger.com/profile/18341209035992944196</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-3697554272614582724' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/3697554272614582724' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-754269788'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-2379106123064391179</id><published>2008-11-16T01:07:00.000-05:00</published><updated>2008-11-16T01:07:00.000-05:00</updated><title type='text'>Microsoft itself used to recommend using the Strin...</title><content type='html'>Microsoft itself used to recommend using the String.Concat() technique instead of &amp;quot;+&amp;quot;, because in .Net 1.x the compiler did NOT optimize concatenations. The recommendation I heard was it was fine to have 3 or 4 concatenations in a row using &amp;quot;+&amp;quot;. If there was more than that, you should&amp;#39;ve used String.Concat(). Also, if you were concatenating in a loop, use String.Concat() or StringBuilder every time.&lt;BR/&gt;&lt;BR/&gt;Optimization was spotty. For example, in C# 1.0 if you wrote:&lt;BR/&gt;&lt;BR/&gt;for (int i = 0; i &amp;lt; array.Length; i++)&lt;BR/&gt;{...}&lt;BR/&gt;&lt;BR/&gt;the compiler would optimize the the call to array.Length, only calling it on the first iteration. It did not do this in VB.Net 1.0, causing array.Length to be called each pass through the loop.&lt;BR/&gt;&lt;BR/&gt;So I&amp;#39;d say don&amp;#39;t beat yourself up that you used String.Concat() all the time on the projects you did a few years ago. You were doing a good thing. Now with .Net 3.x it looks like that sort of thing is no longer necessary.&lt;BR/&gt;&lt;BR/&gt;As for the admonitions about refactoring, I&amp;#39;m all for that. When I&amp;#39;ve worked on projects I refactor bad code every chance I get. The catch is finding the chance to do it. My past experience is software shops don&amp;#39;t want to spend time on refactoring, because it&amp;#39;s not considered a value add. Every time I did it I had to do it on the sly. I&amp;#39;d have a list of bug fixes to do. I&amp;#39;d add in a little time, nothing significant, to fix up some messy code, if that was possible. Sometimes some messy code was depended upon by a lot of other objects, so refactoring it would take too long. I had to leave it. Now, with the refactoring tools that are available, perhaps I&amp;#39;d be able to do even the tough cases.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/2379106123064391179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/2379106123064391179'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html?showComment=1226815620000#c2379106123064391179' title=''/><author><name>Mark Miller</name><uri>http://tekkie.wordpress.com</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-3697554272614582724' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/3697554272614582724' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1705438091'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-286390731933117648</id><published>2008-11-11T11:14:00.000-05:00</published><updated>2008-11-11T11:14:00.000-05:00</updated><title type='text'>Interesting, I threw some code in a dll and put it...</title><content type='html'>Interesting, I threw some code in a dll and put it in reflector and did it compile down to string.concat(object[] { ... } ) so either where i originally read that about string addition was either wrong or they optimized it at some point.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/286390731933117648'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/286390731933117648'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html?showComment=1226420040000#c286390731933117648' title=''/><author><name>dotnetchris</name><uri>http://dotnetchris.wordpress.com/</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/openid16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-3697554272614582724' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/3697554272614582724' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1665716367'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-350470352007412367</id><published>2008-11-10T20:00:00.000-05:00</published><updated>2008-11-10T20:00:00.000-05:00</updated><title type='text'>dotnetchris:&lt;br&gt;&lt;br&gt;I thought the same thing until...</title><content type='html'>dotnetchris:&lt;BR/&gt;&lt;BR/&gt;I thought the same thing until I looked at the generated code:&lt;BR/&gt;&lt;BR/&gt;Take two methods:&lt;BR/&gt;&lt;BR/&gt;string GenerateH1WithConcat(string text) { return string.Concat(&amp;quot;&amp;lt;h1&amp;gt;&amp;quot;, text, &amp;quot;&amp;lt;/h1&amp;gt;&amp;quot;); }&lt;BR/&gt;&lt;BR/&gt;and&lt;BR/&gt;&lt;BR/&gt;string GenerateH1WithPlusOperator(string text) { return &amp;quot;&amp;lt;h1&amp;gt;&amp;quot; + text + &amp;quot;&amp;lt;/h1&amp;gt;&amp;quot;; }&lt;BR/&gt;        &lt;BR/&gt;You&amp;#39;ll see that the compiled IL code is identical:&lt;BR/&gt;&lt;BR/&gt;maxstack 3&lt;BR/&gt;.locals init ([0] string CS$1$0000)&lt;BR/&gt;L_0000: nop &lt;BR/&gt;L_0001: ldstr &amp;quot;&amp;lt;h1&amp;gt;&amp;quot;&lt;BR/&gt;L_0006: ldarg.0 &lt;BR/&gt;L_0007: ldstr &amp;quot;&amp;lt;/h1&amp;gt;&amp;quot;&lt;BR/&gt;L_000c: call string [mscorlib]System.String::Concat(string, string, string)&lt;BR/&gt;L_0011: stloc.0 &lt;BR/&gt;L_0012: br.s L_0014&lt;BR/&gt;L_0014: ldloc.0 &lt;BR/&gt;L_0015: ret &lt;BR/&gt;&lt;BR/&gt;If you look at the results in Reflector using the C# decompiler, both will produce the same C# code (which uses +&amp;#39;s since it looks nicer)&lt;BR/&gt;&lt;BR/&gt;In both cases, the performance tuned 3 argument string concatenation is used that more or less does this:&lt;BR/&gt;&lt;BR/&gt;int length = (str0.Length + str1.Length) + str2.Length;&lt;BR/&gt;string dest = FastAllocateString(length);&lt;BR/&gt;FillStringChecked(dest, 0, str0);&lt;BR/&gt;FillStringChecked(dest, str0.Length, str1);&lt;BR/&gt;FillStringChecked(dest, str0.Length + str1.Length, str2);&lt;BR/&gt;&lt;BR/&gt;which performs one allocation and a fast fill of it. No matter how many things you + together, you&amp;#39;ll still get a relatively fast result. After 4 arguments, a generic version is used that does the same thing but in a loop, which is slightly slower.&lt;BR/&gt;&lt;BR/&gt;In the case of building up a string over the course of several lines or in a loop, it makes sense to use a StringBuilder to avoid a lot of intermediate strings. This is the exception I mentioned in the post.&lt;BR/&gt;&lt;BR/&gt;Am I missing something?&lt;BR/&gt;&lt;BR/&gt;As for String.Empty and &amp;quot;&amp;quot;, I&amp;#39;ll leave that to a personal preference of balancing performance and readability. Whatever you do, just be consistent and I&amp;#39;d be happy :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/350470352007412367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/350470352007412367'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html?showComment=1226365200000#c350470352007412367' title=''/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_Zfbv3mHcYrc/SLDM--5fn8I/AAAAAAAAA1w/EZtLwWvYhdI/S220/facebook+beard2.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-3697554272614582724' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/3697554272614582724' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-252333216'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-6759118799205536964</id><published>2008-11-10T15:22:00.000-05:00</published><updated>2008-11-10T15:22:00.000-05:00</updated><title type='text'>One note I would like to toss in there, it really ...</title><content type='html'>One note I would like to toss in there, it really is a worthwhile change to replace string addition to use string.Concat. String addition creates a new string for every single addition instead of a single result string that string.Concat does.&lt;BR/&gt;&lt;BR/&gt;String addition also can cause issues with string interning so it is a worthwhile "boy scout" change to make, it's also worth while to replace all "" instances with string.Empty.&lt;BR/&gt;&lt;BR/&gt;Just my two cents.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/6759118799205536964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/6759118799205536964'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html?showComment=1226348520000#c6759118799205536964' title=''/><author><name>dotnetchris</name><uri>http://dotnetchris.wordpress.com/</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/openid16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-3697554272614582724' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/3697554272614582724' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1665716367'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-4529731350770113427</id><published>2008-10-31T19:14:00.000-04:00</published><updated>2008-10-31T19:14:00.000-04:00</updated><title type='text'>shawn: glad to hear that a real scout liked it! :)...</title><content type='html'>shawn: glad to hear that a real scout liked it! :)&lt;BR/&gt;&lt;BR/&gt;anonymous: Thanks! Feel free to subscribe to my RSS feed (which includes an email option) at http://feeds.feedburner.com/Moserware</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/4529731350770113427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/4529731350770113427'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html?showComment=1225494840000#c4529731350770113427' title=''/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_Zfbv3mHcYrc/SLDM--5fn8I/AAAAAAAAA1w/EZtLwWvYhdI/S220/facebook+beard2.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-3697554272614582724' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/3697554272614582724' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-252333216'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-1557342775109855141</id><published>2008-10-31T14:44:00.000-04:00</published><updated>2008-10-31T14:44:00.000-04:00</updated><title type='text'>Fantastic post.  I don't know if you have a newsle...</title><content type='html'>Fantastic post.  I don't know if you have a newsletter, sir, but I will subscribe to it!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/1557342775109855141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/1557342775109855141'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html?showComment=1225478640000#c1557342775109855141' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-3697554272614582724' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/3697554272614582724' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-162275390'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-2231938154925934414</id><published>2008-10-31T13:26:00.000-04:00</published><updated>2008-10-31T13:26:00.000-04:00</updated><title type='text'>This is great advice, and I absolutely love the Bo...</title><content type='html'>This is great advice, and I absolutely love the Boy Scout analogy, since I've been actively part of scouting for most of my life.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/2231938154925934414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/3697554272614582724/comments/default/2231938154925934414'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html?showComment=1225473960000#c2231938154925934414' title=''/><author><name>Shawn</name><uri>http://www.shauber.net</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/10/boy-scout-check-ins.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-3697554272614582724' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/3697554272614582724' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1028677567'/></entry></feed>
