<feed xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
    <title>Dugald Wilson's Blog</title>
    <link rel="self" type="application/xml" href="http://dugaldwilson.com/dugald/Atom.aspx" />
    <subtitle type="html">Another waste of your free time.</subtitle>
    <id>http://dugaldwilson.com/dugald/Default.aspx</id>
    <author>
        <name>Dugald Wilson</name>
        <uri>http://dugaldwilson.com/dugald/Default.aspx</uri>
    </author>
    <generator uri="http://subtextproject.com" version="Subtext Version 1.9.4.78">Subtext</generator>
    <updated>2008-08-13T23:50:52Z</updated>
    <entry>
        <title>Commenting Anti-Patterns</title>
        <link rel="self" type="text/html" href="http://dugaldwilson.com/dugald/archive/2008/08/13/Commenting-Anti-Patterns.aspx" />
        <id>http://dugaldwilson.com/dugald/archive/2008/08/13/Commenting-Anti-Patterns.aspx</id>
        <published>2008-08-13T23:47:14-04:00:00</published>
        <updated>2008-08-13T23:50:52Z</updated>
        <content type="html">&lt;p&gt;I've had the opportunity to do some code archaeology lately, and have found a few lessons that bear repeating when it comes to comments.  There are a few patterns in use which need to be addressed:&lt;/p&gt;
&lt;p style="font-weight: bold;"&gt; Big Wall of Text&lt;/p&gt;
&lt;p&gt;This long, rambling preamble can be found in many legacy applications. Though it does have some use in often providing a name to the faceless coder that is causing you such grief, other than that it has little reason to exist:&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;/************************************************************************&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;NAME: test&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;PURPOSE:&lt;/span&gt; &lt;span class="rem"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;REVISIONS:&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;Ver Date Author Description&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;--------- ---------- --------------- ------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;1.0 7/8/2008 1. Created this package.&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;*************************************************************************/&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p style="font-weight: bold;"&gt;This is a Comment&lt;/p&gt;
&lt;p&gt;Really just a statement of the completely obvious in code.  If these comments help the next developer of your code, you probably don't want them touching it anyway:&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (!Page.IsPostBack)&lt;br /&gt;{&lt;br /&gt;  &lt;span class="rem"&gt;// first time&lt;/span&gt;&lt;br /&gt;  InitialSetUp();&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p style="font-weight: bold;"&gt;Change Management:&lt;/p&gt;
&lt;p&gt;Often put in as a CYA for developers who think the next person to view this code may question their decisions, so change documentation appears directly in the code:&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;//************************************************************************&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;//Input parameter changed to false for CommonFilter1.CheckBoxChecked,&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;//please see request-666899.&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;//************************************************************************&lt;/span&gt;&lt;br /&gt;CommonFilter1.CheckBoxChecked(&lt;span class="kwrd"&gt;false&lt;/span&gt;);&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p style="font-weight: bold;"&gt;Timestamp of Changes:&lt;/p&gt;
&lt;p&gt;I really don't care when you did this, and if I did, source control could tell me:&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;//*********************************************************************************&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;// Changes made by OtherDeveloper on May-15,2002 at 6 pm.&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;//***********************************************************************************&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;&lt;p&gt;Please feel free to share other examples of Commenting Anti-Patterns you have encountered!&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;img src="http://dugaldwilson.com/dugald/aggbug/41.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://dugaldwilson.com/dugald/comments/41.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://dugaldwilson.com/dugald/comments/commentRss/41.aspx</wfw:commentRss>
        <trackback:ping>http://dugaldwilson.com/dugald/services/trackbacks/41.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Learning to Love Ruby</title>
        <link rel="self" type="text/html" href="http://dugaldwilson.com/dugald/archive/2008/08/12/Learning-to-Love-Ruby.aspx" />
        <id>http://dugaldwilson.com/dugald/archive/2008/08/12/Learning-to-Love-Ruby.aspx</id>
        <published>2008-08-12T21:15:25-04:00:00</published>
        <updated>2008-08-12T21:28:50Z</updated>
        <content type="html">&lt;p&gt;I've started really stepping up my interest / learning in Ruby, and had one of those "this is great!" moments I wanted to share. &lt;/p&gt;
&lt;p&gt;At work, we've been pulling some names, etc out of the DB that aren't kept in the correct case, but need to be presented in an eye-pleasing manner to the user.  How do we do this? &lt;/p&gt;
&lt;p&gt;Since we're talking about strings, a first check of the string class yields ToUpper(), ToLower(), but no CapitalizetheFirstCharacterAndLowercaseTheRestPlzKThx(), so we will have to keep looking. &lt;/p&gt;
&lt;p&gt;Capitalization of names is affected by the culture, so this may be found in System.Globalization.  Sure enough, TextInfo::ToTitleCase() is what we are looking for. &lt;/p&gt;
&lt;p&gt;So, there is a little extra work to get the conversion to correct capitalization. I need an instance of TextInfo to pass my text to.  Not too bad, but here we go: &lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; passCapitalization = &lt;span class="str"&gt;"testing"&lt;/span&gt;;&lt;br /&gt;System.Globalization.TextInfo  textInfo = System.Globalization.CultureInfo.CurrentCulture.TextInfo;&lt;br /&gt;Console.WriteLine(&lt;span class="str"&gt;"{0} converted to title case: {1}"&lt;/span&gt;, passCapitalization, textInfo.ToTitleCase(passCapitalization));&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
And the output:
&lt;p&gt;&lt;a href="http://www.dugaldwilson.com/images/LearningtoLoveRuby_11CF7/TestingDotNet.png"&gt;&lt;img border="0" style="border-width: 0px;" alt="TestingDotNet" src="http://www.dugaldwilson.com/images/LearningtoLoveRuby_11CF7/TestingDotNet.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;So, how hard is this to do in Ruby? &lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.dugaldwilson.com/images/LearningtoLoveRuby_11CF7/TestingRb.png"&gt;&lt;img border="0" style="border-width: 0px;" alt="TestingRb" src="http://www.dugaldwilson.com/images/LearningtoLoveRuby_11CF7/TestingRb.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Yes, it's easy, but what about for a real business application, where you'd want to capitalize all the words in a sentence? &lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.dugaldwilson.com/images/LearningtoLoveRuby_11CF7/TestingRbMult.png"&gt;&lt;img border="0" style="border-width: 0px;" alt="TestingRbMult" src="http://www.dugaldwilson.com/images/LearningtoLoveRuby_11CF7/TestingRbMult.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Ruby's capitalize string method won't do it, but TextInfo::ToTitleCase will. &lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; doubleCapitalization = &lt;span class="str"&gt;"double testing"&lt;/span&gt;;&lt;br /&gt;Console.WriteLine(&lt;span class="str"&gt;"{0} converted to title case: {1}"&lt;/span&gt;, doubleCapitalization, textInfo.ToTitleCase(doubleCapitalization));&lt;/pre&gt;
&lt;pre class="csharpcode"&gt;&lt;a href="http://www.dugaldwilson.com/images/LearningtoLoveRuby_11CF7/TestingDotNetMultWords.png"&gt;&lt;img border="0" style="border-width: 0px;" alt="TestingDotNetMultWords" src="http://www.dugaldwilson.com/images/LearningtoLoveRuby_11CF7/TestingDotNetMultWords.png" /&gt;&lt;/a&gt; &lt;/pre&gt;
&lt;p&gt;Luckily, Ruby is just our language, and Rails is actually our framework. Rails extends the string class with a titlecase method that does just what we need. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.dugaldwilson.com/images/LearningtoLoveRuby_11CF7/TestingRailsMult.png"&gt;&lt;img border="0" style="border-width: 0px;" alt="TestingRailsMult" src="http://www.dugaldwilson.com/images/LearningtoLoveRuby_11CF7/TestingRailsMult.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;The feeling I got when discovering this was that in using the language and framework, doing what I wanted to do was easy and straightforward. It just worked.&lt;/p&gt;
&lt;p&gt;As a semi-unrelated aside, I feel ToTitleCase is broken in the .Net Framework.  If the output is supposed to be in title case, why does the format of the input matter?  Why does it do nothing when the input is all caps? &lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; failCapitalization = &lt;span class="str"&gt;"FAILING"&lt;/span&gt;;&lt;br /&gt;Console.WriteLine(&lt;span class="str"&gt;"{0} converted to title case: {1}"&lt;/span&gt;, failCapitalization, textInfo.ToTitleCase(failCapitalization));&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://www.dugaldwilson.com/images/LearningtoLoveRuby_11CF7/TestingDotNetFailing.png"&gt;&lt;img border="0" style="border-width: 0px;" alt="TestingDotNetFailing" src="http://www.dugaldwilson.com/images/LearningtoLoveRuby_11CF7/TestingDotNetFailing.png" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://dugaldwilson.com/dugald/aggbug/40.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://dugaldwilson.com/dugald/comments/40.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://dugaldwilson.com/dugald/comments/commentRss/40.aspx</wfw:commentRss>
        <trackback:ping>http://dugaldwilson.com/dugald/services/trackbacks/40.aspx</trackback:ping>
    </entry>
    <entry>
        <title>TriNUG August 2008 - Jeffrey Palermo - TDD, DI, and SoC with ASP.NET MVC</title>
        <link rel="self" type="text/html" href="http://dugaldwilson.com/dugald/archive/2008/08/06/TriNUG-August-2008---Jeffrey-Palermo---TDD-DI-and.aspx" />
        <id>http://dugaldwilson.com/dugald/archive/2008/08/06/TriNUG-August-2008---Jeffrey-Palermo---TDD-DI-and.aspx</id>
        <published>2008-08-06T09:33:50-04:00:00</published>
        <updated>2008-08-06T09:33:50Z</updated>
        <content type="html">&lt;br /&gt;
On Wednesday, Aug 13, Jeffrey Palermo will be talking about separation of concerns, dependency injection, and test driven development with ASP.Net MVC. This should be an excellent discussion on some of the benefits in using the new MVC framework for ASP.Net.&lt;br /&gt;
&lt;br /&gt;
There are some important points to underline about this meeting:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;It will be awesome.&lt;/li&gt;
    &lt;li&gt;Registration is required to manage headcount, especially for our dinner arrangements. &lt;span style="font-weight: bold;"&gt;To attend, you must register on the site.&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;This meeting is &lt;span style="font-weight: bold;"&gt;not at RTI&lt;/span&gt;. The August 13 meeting will be held at &lt;a href="http://maps.live.com/OneClickDirections.aspx?rtp=%7epos.pzbzwz8f5rwc_4101+Doie+Cope+Rd%2c+Raleigh%2c+NC_Ecpi+Technical+College_(919)+785-3303_a_&amp;amp;mkt=en-us&amp;amp;FORM=LLMP"&gt;ECPI&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
This should be a great meeting. Hope to see you there!&lt;img src="http://dugaldwilson.com/dugald/aggbug/39.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://dugaldwilson.com/dugald/comments/39.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://dugaldwilson.com/dugald/comments/commentRss/39.aspx</wfw:commentRss>
        <trackback:ping>http://dugaldwilson.com/dugald/services/trackbacks/39.aspx</trackback:ping>
    </entry>
    <entry>
        <title>BarCampRDU 2008</title>
        <link rel="self" type="text/html" href="http://dugaldwilson.com/dugald/archive/2008/07/31/BarCampRDU-2008.aspx" />
        <id>http://dugaldwilson.com/dugald/archive/2008/07/31/BarCampRDU-2008.aspx</id>
        <published>2008-07-31T14:21:56-04:00:00</published>
        <updated>2008-07-31T14:21:56Z</updated>
        <content type="html">&lt;br /&gt;
BarCampRDU is almost here, and I cannot wait! I attended my first BarCampRDU a year ago.  I volunteered, and got to meet many great folks, and the sessions I sat in on were just great - full of smart people eager to share their ideas and experiences.&lt;br /&gt;
&lt;br /&gt;
The last BarCamp I attended I knew no one. I think that was really a great way to come in. I could focus on the sessions, and what really appealed to me, versus finding my friends and trying to stick with them.  It will be interesting to see if knowing a dozen or more folks at this one changes things.&lt;br /&gt;
&lt;br /&gt;
At the last BarCamp, I did my part by volunteering. I didn't feel like I had an area of expertise to speak in, so I didn't offer up a session. After attending, I now know you don't need to be an expert to lead a topic - often the best topics are discussions that bring together lots of folks contributing their ideas. So in that spirit, I have a few ideas that might make for good discussions:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;What's the deal with &lt;span style="text-decoration: line-through;"&gt;airline food&lt;/span&gt; Twitter? &lt;/li&gt;
    &lt;br /&gt;
    Possibly a 100 level intro for folks that are on the fence about Twitter, but I'd really like to talk about how people are using Twitter, what tricks or tips they have for making it work for them, as well as what doesn't work with Twitter (because being snarky is always fun).&lt;br /&gt;
    &lt;br /&gt;
    &lt;li&gt;I want to start a business that isn't headed for an IPO or  acquisition. Is there a place for me in RTP? &lt;/li&gt;
    &lt;br /&gt;
    A lot of the energy around new companies in the triangle seems focused on the startup pattern of developing a business plan, finding investors, developing product, heading for an exit event. There doesn't seem to be a lot of support or resources for folks simply interested in starting their own business outside of that pattern. I'd like to start a discussion on this and hopefully identify the resources that are out there. &lt;/ul&gt;&lt;img src="http://dugaldwilson.com/dugald/aggbug/38.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://dugaldwilson.com/dugald/comments/38.aspx</wfw:comment>
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://dugaldwilson.com/dugald/comments/commentRss/38.aspx</wfw:commentRss>
        <trackback:ping>http://dugaldwilson.com/dugald/services/trackbacks/38.aspx</trackback:ping>
    </entry>
</feed>