<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>jaredpar's WebLog : Rant</title><link>http://blogs.msdn.com/jaredpar/archive/tags/Rant/default.aspx</link><description>Tags: Rant</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Questions not to hinge a C++ interview on</title><link>http://blogs.msdn.com/jaredpar/archive/2009/04/21/questions-not-to-hinge-a-c-interview-on.aspx</link><pubDate>Tue, 21 Apr 2009 15:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9557943</guid><dc:creator>Jared Parsons</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/jaredpar/comments/9557943.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaredpar/commentrss.aspx?PostID=9557943</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jaredpar/rsscomments.aspx?PostID=9557943</wfw:comment><description>&lt;p&gt;People love to chat about how to conduct a C++ interview on &lt;a href="http://stackoverflow.com/search?q=c%2B%2B+interview"&gt;newsgroups&lt;/a&gt;.&amp;#160; Eventually these topics will shift into a discussion about what questions a candidate &lt;strong&gt;must&lt;/strong&gt; know in order for them to get a hire from a particular interview.&amp;#160; Unfortunately these questions tend to be items like the following.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;What happens when you delete NULL?&lt;/li&gt;    &lt;li&gt;Explain how exceptions affect constructor initialization.&lt;/li&gt;    &lt;li&gt;Which constructors are called for the following: SomeType a = SomeType(b); &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Sure these questions are valid parts of the language and knowing them is a plus and demonstrates a deal of mastery over the language.&amp;#160; But not knowing them should by no means by a deal breaker.&amp;#160; The goal of an interview is to spot good developers who will become a contributing member of the team.&amp;#160; Good developers are motivated and passionate problem solvers.&amp;#160; These questions are testing little more than memorization.&amp;#160; It’s easy to memorize rules after the fact.&amp;#160; It’s much more difficult to teach problem solving skills.&amp;#160; &lt;/p&gt;  &lt;p&gt;The problem with questions like the above is that a developer could be both passionate and competent in C++ and never have come across these rules.&amp;#160; C++ is an unbelievably huge language and can operate in many different ways where these type of situations simply don’t come up.&amp;#160; For instance, I’ve known several very good C++ developers that spent the majority of their time working with COM.&amp;#160; COM prefers HRESULTs to Exceptions and hence they never used exceptions in C++.&amp;#160; Once we introduced exceptions into the code base, it took about 30 minutes to explain the rules and we were done.&amp;#160; &lt;/p&gt;  &lt;p&gt;C++ interviews should focus on the qualities that make a good developer: problem solving and passion.&amp;#160; Of course a language based interview should certainly focus on the foundations of C/C+.&amp;#160; Items like pointers, stack vs. heap and the basics of memory management.&amp;#160; But don’t hinge the deal on little items that can be quickly taught.&amp;#160; Otherwise you’ll end up turning away good developers.&amp;#160; &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9557943" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaredpar/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.msdn.com/jaredpar/archive/tags/Rant/default.aspx">Rant</category></item><item><title>Learching: Definition to live search</title><link>http://blogs.msdn.com/jaredpar/archive/2008/10/01/learching-definition-to-live-search.aspx</link><pubDate>Wed, 01 Oct 2008 15:00:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8968207</guid><dc:creator>Jared Parsons</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/jaredpar/comments/8968207.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaredpar/commentrss.aspx?PostID=8968207</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jaredpar/rsscomments.aspx?PostID=8968207</wfw:comment><description>&lt;p&gt;Unfortunately when creating Live Search, the live team did not use a term which could easily be converted to a verb (i.e. google and google-ing).&amp;#160; The term &amp;quot;live searching&amp;quot; doesn't really flow well in a hallway conversation nearly as well as google-ing.&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;I live searched that movie John was talking about ... &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I considered for awhile just using the &amp;quot;googling&amp;quot; term for both using live search and google.&amp;#160; But this wouldn't allow me to quickly correlate the goods and bads of each search engine.&amp;#160; I needed a new term.&amp;#160; &lt;/p&gt;  &lt;p&gt;Thus learching was born:&amp;#160; It's short for &amp;quot;Live sEARCHing&amp;quot;.&amp;#160; When pronouncing it should rhyme with &amp;quot;searching.&amp;quot;&lt;/p&gt;  &lt;p&gt;Anyone else with a better term?&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8968207" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaredpar/archive/tags/Rant/default.aspx">Rant</category><category domain="http://blogs.msdn.com/jaredpar/archive/tags/Humor/default.aspx">Humor</category></item><item><title>Where does the * go?</title><link>http://blogs.msdn.com/jaredpar/archive/2008/09/04/where-does-the-go.aspx</link><pubDate>Thu, 04 Sep 2008 15:00:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8922727</guid><dc:creator>Jared Parsons</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/jaredpar/comments/8922727.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaredpar/commentrss.aspx?PostID=8922727</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jaredpar/rsscomments.aspx?PostID=8922727</wfw:comment><description>&lt;p&gt;This is a more amusing than functional debate I enter into from time to time.&amp;nbsp; On a line where you declare a pointer type in C++, where should the * go?&amp;nbsp; &lt;/p&gt; &lt;ol&gt; &lt;li&gt;Next to the type (i.e. Type* p1;) &lt;li&gt;Next to the variable name&amp;nbsp; (i.e. Type *p1;) &lt;li&gt;Who cares&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;For the moment lets ignore #3 (after all they don't care).&amp;nbsp; I'm a firm believer in #1.&amp;nbsp; After all * is a part of the type of the variable, not the name and therefore should be closer to the type.&amp;nbsp; &lt;/p&gt; &lt;p&gt;#2 believers disagree with this notion.&amp;nbsp; They believe the * is a part of the individual variable's type and not the actual type.&amp;nbsp; This is technically correct and can be demonstrated with the following code&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;pre&gt;  Type* p1, p2;
&lt;/pre&gt;
&lt;p&gt;The type of p2 is of course Type and not Type*. Therefore they argue, #2 is the superior way&lt;/p&gt;
&lt;p&gt;This is true but I'm also a firm believer in don't declare multiple variables in a single declaration statement while coding in C++ unless the type has a user defined constructor.&amp;nbsp; Namely to avoid situations just like this.&amp;nbsp; &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8922727" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaredpar/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.msdn.com/jaredpar/archive/tags/Rant/default.aspx">Rant</category></item><item><title>Comments</title><link>http://blogs.msdn.com/jaredpar/archive/2008/08/26/comments.aspx</link><pubDate>Tue, 26 Aug 2008 15:00:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8890666</guid><dc:creator>Jared Parsons</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/jaredpar/comments/8890666.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaredpar/commentrss.aspx?PostID=8890666</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jaredpar/rsscomments.aspx?PostID=8890666</wfw:comment><description>&lt;p&gt;If only people spent as much time writing comments as they did speaking to the evils of comments.&amp;#160; Everything from useless, inaccurate, to many comments make code unreadable, you should code better ... etc.&amp;#160; &lt;/p&gt;  &lt;p&gt;I haven't ever looked at a piece of code and thought &amp;quot;wow, way too many comments&amp;quot; or &amp;quot;that code would be beautiful if it weren't for the comments.&amp;quot;&lt;/p&gt;  &lt;p&gt;Do the next guy a favor, comment your code.&amp;#160; &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8890666" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaredpar/archive/tags/Rant/default.aspx">Rant</category></item><item><title>To name a tuple value: A or Item0?</title><link>http://blogs.msdn.com/jaredpar/archive/2008/06/23/to-name-a-tuple-value-a-or-item0.aspx</link><pubDate>Mon, 23 Jun 2008 15:00:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8599391</guid><dc:creator>Jared Parsons</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jaredpar/comments/8599391.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaredpar/commentrss.aspx?PostID=8599391</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jaredpar/rsscomments.aspx?PostID=8599391</wfw:comment><description>&lt;p&gt;One of the parts of a Tuple implementation for &lt;a href="http://code.msdn.microsoft.com/RantPack"&gt;RantPack&lt;/a&gt; I struggled the most with was naming.&amp;#160; I tend to struggle with names quite a bit and there's really no reason for it.&amp;#160; It's a combination of pickiness and ... well there's really no good reason.&amp;#160; Pieces which can bother me range from &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Don't like the way it types.&amp;#160; If I can't type something easily it drives me nuts and I secretly desire to change it to a word that is easier to type.&amp;#160; I have sadly spent a large amount of time on &lt;a href="http://www.thesaurus.com"&gt;www.thesaurus.com&lt;/a&gt; looking for better words to type.&lt;/li&gt;    &lt;li&gt;Looks funny.&amp;#160; No real solid criteria here, just what I don't like.&amp;#160; Words sometimes look good the first time you type them but over time lose their appeal&lt;/li&gt;    &lt;li&gt;Doesn't match conventions.&amp;#160; Ah, now we're onto solid reasons.&amp;#160; Names should match conventions.&lt;/li&gt;    &lt;li&gt;Name is ambiguous.&amp;#160; If the name doesn't give a clear intention of the operation I do my best to change it.&amp;#160; &lt;/li&gt;    &lt;li&gt;FxCop violation.&amp;#160; This bothers me less than others but if FxCop doesn't like it I think a bit harder about naming it. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Now comes Tuples.&amp;#160; Many implementations of tuples don't even have names but instead rely on language constructs such as pattern matching to access the values.&amp;#160; That's not really the DotNet way of doing things though so I chose to give Tuple values names.&amp;#160; &lt;/p&gt;  &lt;p&gt;Originally I chose A for item 0, B for item 1, etc ...&amp;#160; This made sense at the time because it kept the syntax short.&amp;#160; However I've grown to dislike this naming convention.&amp;#160; Primarily because it violates #3 and #4 above.&amp;#160; While A-E is perfectly clear for me I've talked with others who this confuses.&amp;#160; &lt;/p&gt;  &lt;p&gt;In addition, to keep the nameless syntax option I provided an indexer property.&amp;#160; So values are available with a 0 based index.&amp;#160; Since several languages expose this with the name &amp;quot;Item&amp;quot;, there are now really two names for a value.&amp;#160; For example the first value is both tuple.A and tuple.Item[0].&amp;#160; &lt;/p&gt;  &lt;p&gt;After some thought I decided to name the values Item0-&amp;gt;Item4 depending on the size of the tuple.&amp;#160; &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8599391" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaredpar/archive/tags/Rant/default.aspx">Rant</category><category domain="http://blogs.msdn.com/jaredpar/archive/tags/RantPack/default.aspx">RantPack</category></item><item><title>Code is not self documenting</title><link>http://blogs.msdn.com/jaredpar/archive/2008/06/09/code-is-not-self-documenting.aspx</link><pubDate>Mon, 09 Jun 2008 15:00:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8580206</guid><dc:creator>Jared Parsons</dc:creator><slash:comments>17</slash:comments><comments>http://blogs.msdn.com/jaredpar/comments/8580206.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaredpar/commentrss.aspx?PostID=8580206</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jaredpar/rsscomments.aspx?PostID=8580206</wfw:comment><description>&lt;p&gt;Nothing revolutionary about that statement.&amp;#160; Yet I keep reading the opposite on various comment threads and message boards so I thought it a good idea to explore it again.&lt;/p&gt;  &lt;p&gt;Code is not self documenting.&lt;/p&gt;  &lt;p&gt;The &amp;quot;code is self document&amp;quot; argument often comes up when commenting conventions, patterns and overall usage is discussed.&amp;#160; People who are typically against writing more than the existing set of comments will throw out the argument &amp;quot;if we need a comment then the code should be written to be self documenting.&amp;quot;&amp;#160; &lt;/p&gt;  &lt;p&gt;To at extent I agree with this.&amp;#160; Code should not be obfuscated and the usage should be clear.&amp;#160; I personally strive to make my implementations as clear as possible and enforce that belief on anyone who asks me for a code review.&amp;#160; &lt;/p&gt;  &lt;p&gt;Yet while you can write code so that an individual algorithm or function is close to self documenting you cannot write it in such a way that it will explain it's greater purpose in a program.&amp;#160; Only comments can do that.&amp;#160; Self describing code can only describe itself, not it's purpose in the bigger picture.&amp;#160; &lt;/p&gt;  &lt;p&gt;Comments serve to both 1) explain the algorithm and 2) explain the greater purpose of the algorithm in the program.&lt;/p&gt;  &lt;p&gt;Yet people still cling to the code is self documenting mantra.&amp;#160; In my experience there are several reasons for this belief.&amp;#160;&amp;#160; The first is that people have only worked on projects small enough that for most purposes they can be kept entirely in their mind [*].&amp;#160; Until you work on a big enough program #2 is not even a factory because you intimately understand how every function fits into the big picture.&amp;#160; &lt;/p&gt;  &lt;p&gt;Another is that they have never worked on a project with people they weren't very familiar with.&amp;#160; People you don't know well or have worked with before will likely have different ways and practices of approaching a problem which you have not encountered before.&amp;#160; What is obvious to them won't be obvious to you.&amp;#160; The bridge between these approaches are comments.&lt;/p&gt;  &lt;p&gt;I've seen DRY (don't repeat yourself) brought up as well [**].&amp;#160; The code clearly says what it does so adding a comment is just repeating yourself.&amp;#160; I find that to be patently untrue.&amp;#160; If we're even having the conversation then the code is clearly not self documenting.&amp;#160; Also in the cases when an individual function is documenting you will still run into #2.&amp;#160; &lt;/p&gt;  &lt;p&gt;Commenting your code benefits both people who are reading your code and yourself.&amp;#160; You will eventually come to a point where you've forgotten what a particular piece of code did or how it fit into your bigger program.&amp;#160; Your comments will save you.&lt;/p&gt;  &lt;pre&gt;[*] The temptation to say &amp;quot;kept in memory&amp;quot; here was huge but I avoided it.
[**] In general I think that DRY is a great approach to programming but I feel it's being taken to far here&lt;/pre&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8580206" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaredpar/archive/tags/Rant/default.aspx">Rant</category></item><item><title>Outdated Comments are better than no Comments</title><link>http://blogs.msdn.com/jaredpar/archive/2008/05/20/outdated-comments-are-better-than-no-comments.aspx</link><pubDate>Tue, 20 May 2008 15:00:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8521019</guid><dc:creator>Jared Parsons</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/jaredpar/comments/8521019.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaredpar/commentrss.aspx?PostID=8521019</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jaredpar/rsscomments.aspx?PostID=8521019</wfw:comment><description>&lt;p&gt;While investigating our locking infrastructure a few days ago I ran across an odd comment.&amp;#160; I was looking at a particular usage of a lock and the comment said that &amp;quot;Using lock type X because we must pump messages here.&amp;quot;&amp;#160; Contrarily the lock type being used most definitely did not allow message pumping.&amp;#160; &lt;/p&gt;  &lt;p&gt;After a quick history search on the code base I was able to track down the developer responsible for the discrepancy.&amp;#160; He merely forgot to update the comment when making the change.&amp;#160; However he was able to explain the history behind the comment and the switching of the locking type.&amp;#160; &lt;/p&gt;  &lt;p&gt;I've heard people argue in the past that they didn't comment code because comments get out of date and lead developers in the wrong direction.&amp;#160; They might do it correctly but they didn't trust the next guy.&amp;#160; Then the comment would be wrong and useless for the next developer.&lt;/p&gt;  &lt;p&gt;I think this is a example of why that mentality is wrong. &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Even though it was currently wrong it was historically accurate&lt;/li&gt;    &lt;li&gt;The commented add good insight into the choice of locking mechanism&lt;/li&gt;    &lt;li&gt;It added a bit of detail into the historical architecture of the code base.&lt;/li&gt;    &lt;li&gt;It was a heck of a lot better than staring at a comment-less field that appeared to exist for no reason.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;I'm not arguing that comments which are flat out wrong at the time they are authored are a valuable resource.&amp;#160; Yet not commenting because you don't &amp;quot;trust&amp;quot; the next guy is equally wrong. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8521019" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaredpar/archive/tags/Rant/default.aspx">Rant</category></item><item><title>Reserved words: Good for your sanity</title><link>http://blogs.msdn.com/jaredpar/archive/2008/05/13/reserved-words-good-for-your-sanity.aspx</link><pubDate>Tue, 13 May 2008 15:00:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8480445</guid><dc:creator>Jared Parsons</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/jaredpar/comments/8480445.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaredpar/commentrss.aspx?PostID=8480445</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jaredpar/rsscomments.aspx?PostID=8480445</wfw:comment><description>&lt;p&gt;Paul Vick &lt;a href="http://www.panopticoncentral.net/archive/2008/05/08/23317.aspx"&gt;posted&lt;/a&gt; a recent entry exploring the necessity, or lack there of, for having reserved words in a programming language.&amp;nbsp; It's an interesting mental exercise to go through.&amp;nbsp; At the end you'll realize that many reserved keywords aren't needed from the perspective of the compiler.&amp;nbsp; This is part of the reason C# and VB are defaulting more to contextual keywords in recent releases.&amp;nbsp; What the blog post didn't really talk about though was the programmer.&amp;nbsp; From the programmer's perspective there is one great reason for reserved words.&lt;/p&gt; &lt;p&gt;Sanity.&lt;/p&gt; &lt;p&gt;Going through legacy code is hard enough already.&amp;nbsp; Reserved words at least allow you to mentally structure the code you are looking at.&amp;nbsp; If there was open season on the use of keywords you know someone will take advantage and flat out abuse the system.&amp;nbsp; Can you imagine digging through some legacy C++ and seeing the following [1]&lt;/p&gt;&lt;pre&gt;class int : public new { public: new private; }
new void() {
  int int = new new;
  int.private = int;
  return int;
}&lt;/pre&gt;
&lt;p&gt;Reading that makes my head hurt.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Having reserved words is a language adds a modicum of structure.&amp;nbsp; Language structure allows developers to more quickly grasp the meaning and intent of a piece of code.&amp;nbsp; Can you imagine trying to grasp a more complex example?&amp;nbsp; Now imagine the programmer had several thousand lines of undocumented code with this pattern.&amp;nbsp; Not fun.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;[1] Yes I realize that making new/int non-reserved words may not be possible in C++.&amp;nbsp; But this is just a hypothetical example.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8480445" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaredpar/archive/tags/Rant/default.aspx">Rant</category></item><item><title>What's the purpose of this blog?</title><link>http://blogs.msdn.com/jaredpar/archive/2008/04/17/what-s-the-purpose-of-this-blog.aspx</link><pubDate>Thu, 17 Apr 2008 15:00:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8399850</guid><dc:creator>Jared Parsons</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jaredpar/comments/8399850.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaredpar/commentrss.aspx?PostID=8399850</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jaredpar/rsscomments.aspx?PostID=8399850</wfw:comment><description>&lt;p&gt;I've had a couple people ask me this question about my blog.&amp;#160; The simple answer is: to explore my adventures in code, coding, patterns and pretty much anything else related to programming.&amp;#160; &lt;/p&gt;  &lt;p&gt;I realize from a readers perspective my topics may appear somewhat random.&amp;#160; After all I post in C#,VB,C++ and Powershell with varying degrees of frequency.&amp;#160; I jump from patterns to specialized templates to threading to random gotchas to API Design.&amp;#160; The reason for the jumping is I post topics close to the projects I'm working on and I work on a lot of projects :).&amp;#160; At any given time I'm working on one of the following items.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;My job as developer on the VB Debugger and IDE&lt;/li&gt;    &lt;li&gt;My personal managed utility libraries (non-UI and UI) [1]&lt;/li&gt;    &lt;li&gt;The &lt;a href="http://blogs.msdn.com/jaredpar/archive/2008/03/14/making-pinvoke-easy.aspx"&gt;PInvoke Interop Assistant&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Several internal tools &lt;/li&gt;    &lt;li&gt;My scripting environment&lt;/li&gt;    &lt;li&gt;Customer reported issues in forums&lt;/li&gt;    &lt;li&gt;This blog &lt;/li&gt;    &lt;li&gt;Whatever happens to capture my interest at the time.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Whenever I discover anything interesting, find a bug or see yet another pattern/design I like or dislike I try to blog about it.&amp;#160; I do this for two reasons. &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;My own personal sanity.&amp;#160; I've found through years of programming that it's very unlikely you will hit an error only once.&amp;#160; Instead you're likely to see it time and time again.&amp;#160; Blogging about it both helps firm the issue into memory and gives me a great reference to fall back onto the next time I see that bug.&amp;#160; It's really simple to lookup a blog post by tag and read it or point a coworker to it.&lt;/li&gt;    &lt;li&gt;Everyone else's sanity.&amp;#160; The more people who write about issues, the more likely someone else will find an answer when they enter a problem into a search engine.&amp;#160; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;In short, I love to write and talk about code and this is a great forum.&lt;/p&gt;  &lt;p&gt;[1] Hopefully on it's way to &lt;a href="http://code.msdn.com"&gt;http://code.msdn.com&lt;/a&gt; so I don't have to keep posting little snippets and making users paste snippets from various blog entries to get a simple working example.&amp;#160; &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8399850" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaredpar/archive/tags/Blogging/default.aspx">Blogging</category><category domain="http://blogs.msdn.com/jaredpar/archive/tags/Rant/default.aspx">Rant</category></item><item><title>Part of being a good programmer is learning not to trust yourself</title><link>http://blogs.msdn.com/jaredpar/archive/2008/03/24/part-of-being-a-good-programmer-is-learning-not-to-trust-yourself.aspx</link><pubDate>Mon, 24 Mar 2008 19:28:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8333794</guid><dc:creator>Jared Parsons</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/jaredpar/comments/8333794.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jaredpar/commentrss.aspx?PostID=8333794</wfw:commentRss><wfw:comment>http://blogs.msdn.com/jaredpar/rsscomments.aspx?PostID=8333794</wfw:comment><description>&lt;p&gt;... and to actively guard against yourself.&lt;/p&gt; &lt;p&gt;Over the years I've found that I can be my own worst enemy when I code. Part of the problem stems from paranoia&lt;/p&gt; &lt;p&gt;Early in my college days, a professor of mine, Jim Greenlee, instilled in me the virtue of paranoid programming. He taught an introduction to C class on a Linux/Unix environment. Our code had to compile with no warnings or errors on Linux and Unix, pass lint, and withstand all manner of evil input the TA's could throw at it. Catching a mistake and printing out an error was bad, but acceptable. Crashing was an immediate 0. Towards the end of the semester, I usually wrote two programs for the each assignment: 1) the assignment and 2) a Perl script designed to automate and generally speaking cat /dev/random into the program.&lt;/p&gt; &lt;p&gt;Over time, this process led to a healthy suspicion of any code that I used (not so much my code, but code I didn't own or didn't actively work in). As a result, I now rarely make assumptions about how other people's code works. I probe, search, test and investigate any assumption about resource management, lifetime, etc . When I'm working on my code, however, I tend to assume I got it right and followed such patterns as RAII. And therein lies the problem: no one is perfect, and I should be as paranoid about the quality of my code as anyone else's. &lt;/p&gt; &lt;p&gt;I find this problem happens most often on the border of my code and the rest of the program. I think this is true for most programmers. You understand your model and the manner in which you expect it to behave. On the fringes of your program, you expect other code to behave properly or your code to account for various conditions. In reality, it's doubtful that both you and the programmer owning the other end of the code had exactly the same thought pattern.&amp;nbsp; Also it's doubtful you understand all the variations in behavior in the other programmers code.&lt;/p&gt; &lt;p&gt;To further complicate matters, you are not the same programmer you were yesterday. Hopefully you're better. As a programmer you constantly learn new patterns, better methods and discipline. So when you program against code you've written, you're approaching it with a different mindset and hence you take different paths. In short, you're programming against someone else's code and assumptions.&amp;nbsp; &lt;/p&gt; &lt;p&gt;For instance there was a time where I didn't actively use RAII in my code.&amp;nbsp; Now I base all my C++ classes around this pattern and use it everywhere.&amp;nbsp; These days I tend to assume my classes implement this pattern.&amp;nbsp; I've been bitten a few times when using older code that pre-dated my use of RAII.&amp;nbsp; &lt;/p&gt; &lt;p&gt;The best way to avoid making bad assumptions is to actively question them at all times. Guarding against your assumptions can occur at several levels. Over time, I've found the following methods to be the most effective:&lt;/p&gt;&lt;strong&gt; &lt;h3&gt;1) Don't trust yourself &lt;/h3&gt;&lt;/strong&gt; &lt;p&gt;Be as paranoid about yourself as others.&lt;/p&gt;&lt;strong&gt; &lt;h3&gt;&lt;strong&gt;2) Turn Assumptions into Compiler Errors&lt;/strong&gt; &lt;/h3&gt;&lt;/strong&gt; &lt;p&gt;This is most effective when coding in C++. Occasionally I run into a situation where we find certain classes are invalid inputs to a template, function, etc ...&amp;nbsp; The best way to prevent using the type in the wrong context is to turn it into a compiler error.&amp;nbsp; Typically this is accomplished with a combination of macros and templates. It's not pretty, but catching an error at compile time is the cheapest way.&amp;nbsp; You can't ship a bug that doesn't compile.&amp;nbsp; &lt;/p&gt;&lt;strong&gt; &lt;h3&gt;3) Unit Testing &lt;/h3&gt;&lt;/strong&gt; &lt;p&gt;I once heard an engineer say that "1 test is worth 1000 expert opinions." It doesn't matter how good you are or how simple the code is; given enough time, you will make mistakes. The most effective and lasting way to ensure that you don't make mistakes is to test your code relentlessly.&lt;/p&gt; &lt;p&gt;The other great aspect is it allows you to freeze an assumption in time. The point at which you write the code is the best time to catalog the intended behaviors of your code. Adding a unit test will preserve and enforce it for the perceivable future.&amp;nbsp;&amp;nbsp; &lt;/p&gt; &lt;h3&gt;4) Retail Contracts &lt;/h3&gt; &lt;p&gt;Retail contracts are similar to debug asserts. The difference is that they run in retail as well as debug builds. Generally speaking in retail it will cause a crash and Watson dump. &lt;/p&gt; &lt;p&gt;I've debated the merits of such an approach many times. But the principal that wins for me is "if it's wrong at debug time, it's wrong at retail time". It's much easier to catch a problem sooner rather that later. This is especially true for C++ where problems can behave unpredictably and result in "random" failures. Crashing on a line which says Contract.ThrowIfNull() leaves little doubt to where the failure came from. It doesn't necessarily make finding the underlying cause easier but it's a start.&lt;/p&gt; &lt;p&gt;I've heard the argument that checks are non-performant and shouldn't be done in retail code. Most retail checks resort down to "if(!ptr) throw". Yes, if you put many,many of these checks into a hot path of your code base it can cause a performance problem. In my experience it's very unlikely that this will happen. And if it does show up on a profile, it's a simple matter to switch them to a debug assert, or move the retail assert further down in the stack and out of the hot path.&lt;/p&gt; &lt;h3&gt;5) Debug Asserts&lt;/h3&gt;  &lt;p&gt;I find debug asserts are nice for verification that is to expensive to run in retail. I don't mean this to include simple NULL checks but more deep verification of various data sets.&lt;/p&gt;&lt;strong&gt; &lt;h3&gt;&lt;strong&gt;*) Code Reviews&lt;/strong&gt; &lt;/h3&gt;&lt;/strong&gt; &lt;p&gt;I didn't put this into any specific order because this is highly dependent upon the person reviewing your code. I feel the other listed points add a consistent level of quality to your code.&amp;nbsp; Bad code reviewers offer little help in guarding against yourself and hence do little for quality. Good code reviewers offer good protection but it's a one time shot so I still would put it between unit testing and retail contracts.&lt;/p&gt; &lt;p&gt;There are the few people who have an amazing talent for code reviews. They will make even the most experience programmer come out feeling like an incompetent novice. They are invaluable and even though they are able to shame me at times I insist upon code reviews from them when writing a feature.&amp;nbsp; &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8333794" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jaredpar/archive/tags/Rant/default.aspx">Rant</category></item></channel></rss>