<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>blairdev&#039;s Blog</title>
	<atom:link href="http://blairdev.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blairdev.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Thu, 28 Jul 2011 02:05:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blairdev.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>blairdev&#039;s Blog</title>
		<link>http://blairdev.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blairdev.wordpress.com/osd.xml" title="blairdev&#039;s Blog" />
	<atom:link rel='hub' href='http://blairdev.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Visual Studio 2010 Crashing</title>
		<link>http://blairdev.wordpress.com/2011/07/27/visual-studio-2010-crashing/</link>
		<comments>http://blairdev.wordpress.com/2011/07/27/visual-studio-2010-crashing/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 11:25:04 +0000</pubDate>
		<dc:creator>blairdev</dc:creator>
				<category><![CDATA[Notebook]]></category>
		<category><![CDATA[Visual Studio 2010 Crashes]]></category>

		<guid isPermaLink="false">http://blairdev.wordpress.com/?p=141</guid>
		<description><![CDATA[I have been fighting Visual Studio 2010 crashing when I open Internet Explorer 9 on Windows 7 operating system for months. I finally managed to fix the problem by downloading SP1 for Visual Studio. Once it installed and I rebooted my system, both Visual Studio 2010 and Internet Explorer seem to be playing nice together [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=141&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been fighting Visual Studio 2010 crashing when I open Internet Explorer 9 on Windows 7 operating system for months. I finally managed to fix the problem by downloading SP1 for Visual Studio. Once it installed and I rebooted my system, both Visual Studio 2010 and Internet Explorer seem to be playing nice together again. Good grief! </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blairdev.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blairdev.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blairdev.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blairdev.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/blairdev.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/blairdev.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/blairdev.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/blairdev.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blairdev.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blairdev.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blairdev.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blairdev.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blairdev.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blairdev.wordpress.com/141/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=141&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blairdev.wordpress.com/2011/07/27/visual-studio-2010-crashing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c8a3c140447b4a4502874ecee4f8848f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">blairdev</media:title>
		</media:content>
	</item>
		<item>
		<title>Refactor, Not Rebuild</title>
		<link>http://blairdev.wordpress.com/2010/02/14/refactor-not-rebuild/</link>
		<comments>http://blairdev.wordpress.com/2010/02/14/refactor-not-rebuild/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 02:51:17 +0000</pubDate>
		<dc:creator>blairdev</dc:creator>
				<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://blairdev.wordpress.com/?p=120</guid>
		<description><![CDATA[Introduction I can&#8217;t tell you how many times while working with clients I have heard; &#8220;this system needs to be totally rebuilt.&#8221; Which, in most cases, is a very bad idea at best and a disaster at worst. I would like suggest to those in the &#8220;rebuild the system&#8221; camp to relax, refactor, and move forward in an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=120&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>I can&#8217;t tell you how many times while working with clients I have heard; &#8220;this system needs to be totally rebuilt.&#8221; Which, in most cases, is a very bad idea at best and a disaster at worst. I would like suggest to those in the &#8220;rebuild the system&#8221; camp to relax, refactor, and move forward in an iterative fashion.</p>
<h2>Refactoring</h2>
<p>It really is this simple, every time you go into a piece of existing code, leave it better than when you started. That means refactor by breaking up long methods and badly named methods that are difficult to understand. Rename &#8220;things&#8221; so that they are more clear; you should be able to understand the code for the most part with out using excessive commenting. Do not worry about &#8220;patterns&#8221; until the code base is stable and predictable with automated tests. Everyone one wants to jump on the &#8220;patterns&#8221; band wagon but I am telling you that until the code is stable and broken into reuseable objects there is no reason to even consider patterns.</p>
<h2>Keys for success (conclusion):</h2>
<ul>
<li>Automated test suite (of course, you need this regardless if you are building new code or refactoring)</li>
<li>Refactor a little at a time (Do try to redo the entire project at once. Identify small sections that can be refactor and move on)</li>
<li>Don&#8217;t get fancy! You don&#8217;t have to move the existing code to design patterns or slick algorithms. Just make it work and concentrate on clean code! </li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blairdev.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blairdev.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blairdev.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blairdev.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/blairdev.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/blairdev.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/blairdev.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/blairdev.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blairdev.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blairdev.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blairdev.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blairdev.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blairdev.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blairdev.wordpress.com/120/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=120&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blairdev.wordpress.com/2010/02/14/refactor-not-rebuild/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c8a3c140447b4a4502874ecee4f8848f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">blairdev</media:title>
		</media:content>
	</item>
		<item>
		<title>Developers Don&#8217;t Design For Object Behavioral Exceptions</title>
		<link>http://blairdev.wordpress.com/2009/12/18/developers-dont-design-for-object-behavioral-exceptions/</link>
		<comments>http://blairdev.wordpress.com/2009/12/18/developers-dont-design-for-object-behavioral-exceptions/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 18:31:58 +0000</pubDate>
		<dc:creator>blairdev</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Software Object Behavior]]></category>

		<guid isPermaLink="false">http://blairdev.wordpress.com/?p=108</guid>
		<description><![CDATA[Introduction Most of the time when I look at object designs I find that folks build systems without fully understanding the application domain. To rephrase that, I am saying that software developers build systems without fully understanding all the parts of what the client needs are. Of course, the difficult thing about this is most [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=108&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Most of the time when I look at object designs I find that folks build systems without fully understanding the application domain. To rephrase that, I am saying that software developers build systems without fully understanding all the parts of what the client needs are. Of course, the difficult thing about this is most clients don&#8217;t have that knowledge either; or, it might be they forget to tell you many of the details associated with a particular business event that ends up compromising the final design. Clients have much of their knowledge wrapped up in their heads, and not on paper on in work instructions. This <em>tacit</em> knowledge is a major concern to software developers and can be the most difficult aspect of building maintainable software.</p>
<h2>Object Problems</h2>
<p>One of the main problems I run across when looking at existing systems is that they (the systems) are very difficult to maintain due to lack of business logic understanding on the part of the initial developer. The single biggest issue I face when extending or expanding existing software systems is that the objects have been poorly designed and do not take into consideration all the business logic necessary to add functionality without totally rewriting the software object itself. The objects are either incomplete or immature in fundamentals. What this does is cause programmers to add a ton of  &#8220;if&#8221; statements and &#8220;case&#8221; statements into the code to make up for the exceptions caused by not understanding the business logic.</p>
<h2>Object Behavior</h2>
<p>Object behavior is the idea of designing a system of objects that interact according to how the actual real-life system behaves. This is totally different that designing according to <em>what</em> a real-life system <em>is</em>. It is like asking yourself, &#8220;how does a person behave&#8221; rather than, &#8220;what are the properties of a person&#8221; &#8230; if we are using a <em>person</em> as a design object as so often you see in books and code examples. In using an &#8220;object behavior&#8221; approach to design you are forced into domain discovery more than with &#8220;object property&#8221; design. This will almost always produce a hierarchy of objects using inheritance much more than property design. It will also tend to push a lot of the decision making for domain exceptions down to object creation (using polymorphism) rather than if-else or case statements, which is usually a better, more maintainable design.</p>
<p>A simple (real life) example is a paint line that paints small car parts. The initial developers designed the system with a single object (part) that gets a paint record when scanned into the system. Each part must have a mold record between certain dates or that particular part must have special treatment before it gets painted. There was a string of &#8220;if&#8221; statements in the code that tested for all sorts of exceptions; such as: is the part a reinforcement in which case it doesn&#8217;t need a record. Is the part scanned by a manufacturer that requires a different sort of paint? Is the part an assembly which itself doesn&#8217;t require a mold record but it does require looking up all of its sub-parts for correct mold records. So you can see how complicated the code might get looking for all sorts of exceptions to a very general domain rule, &#8220;does this part have a mold and is that record within an exceptable range? With more diligent behavior discovery initially the developers would have realized that the behavior of the parts would have classified themselves into objects and then they could have used polymorphism much more effectively.</p>
<h2>Conclusion</h2>
<p>While it seems easy to build decision constructs into code to take care of domain exceptions you will be much better served in the long haul to do a more thorough investigation into object behavior using polymorphism in place of if-else and case statements. Assuming most of the lifespan of the code with actually be in maintenance phase, the extra time in understanding and building a better system will more than pay for itself in software updates alone, not to mention the fact the code will work better. If you are coming behind others modifying code, like many of us do, then refactoring to better object models is absolutely essential unless the code you are working on is to be retired soon anyway.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blairdev.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blairdev.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blairdev.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blairdev.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/blairdev.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/blairdev.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/blairdev.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/blairdev.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blairdev.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blairdev.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blairdev.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blairdev.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blairdev.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blairdev.wordpress.com/108/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=108&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blairdev.wordpress.com/2009/12/18/developers-dont-design-for-object-behavioral-exceptions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c8a3c140447b4a4502874ecee4f8848f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">blairdev</media:title>
		</media:content>
	</item>
		<item>
		<title>Programming with Programmers</title>
		<link>http://blairdev.wordpress.com/2009/10/05/building-software/</link>
		<comments>http://blairdev.wordpress.com/2009/10/05/building-software/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 14:45:11 +0000</pubDate>
		<dc:creator>blairdev</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Notebook]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://blairdev.wordpress.com/?p=80</guid>
		<description><![CDATA[Introduction As you know, software developers spend a fair amount of time with our noses stuffed into books, websites, and whitepapers trying to further our design knowledge, reduce construction time, and improve return on investment for ourselves and our companies. We all want to build better software, right? We buy books on software construction techniques. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=80&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>As you know, software developers spend a fair amount of time with our noses stuffed into books, websites, and whitepapers trying to further our design knowledge, reduce construction time, and improve return on investment for ourselves and our companies. We all want to build better software, right? We buy books on software construction techniques. We read articles on topics like &#8220;using metaphor in use cases&#8221; and &#8220;practical UML&#8221; and &#8220;.NET pattern shortcuts&#8221; and the list goes on. We study software patterns, anti-patterns, and refactoring techniques. We spend money to go to seminars and training. The truth of the matter is; however, the only way to really improve the way we build software is to do it, over and over and over and over. In other words, just like in sports, fine art, music, cooking, and just about anything else, we have to practice to get better. There is no way, for example, to read books and watch videos on how to play guitar and expect to improve without practicing what we have learned first. You still need to know the information in the books and videos; but, it takes practicing those skills to really improve. And in fact, just like with music, you can progress much faster if you have someone teaching you the skills and showing you what you are doing wrong, and right!</p>
<h2>The Problem</h2>
<p>Most developers work in isolation in small companies supporting products and business operations of the company in which they work. That means that the development staff is probably pretty small and not funded very well, and understandably so. Business folks have trouble understanding the importance of anything that isn&#8217;t directly instrumental in product production. So, as a developer in small and mid-sized companies you probably are working on lots of different projects with little time for software engineering techniques, or at least that is the way it seems. Technical training for the IT staff is many times laughable while testing and usability is simply unheard of.</p>
<p>I have worked in large development companies with lots of development resources; and, in very small companies where software development is considered a necessary evil. Both situations can produce equally bad software and both can produce very good software. The &#8220;trick&#8221; to producing well designed, stable software is developer attitudes and programming habits.</p>
<h4>Some of the issues:</h4>
<ul>
<li> over simplified examples &#8211; in books and on websites</li>
<li>no manager or team support within the organization</li>
<li>no training or apprentice programs for employees</li>
<li>old habits are hard to break fostering stagnation</li>
</ul>
<p>Let&#8217;s look at these issues one by one.</p>
<p>First, programmers purchase books and scour the web for examples and techniques in an attempt to improve their software skill sets. This is great and definitely helps but there lurks a dangerous trap and one that programmers can can easily fall into without ever even being aware of it. Almost all examples I have ran across in books are far too remedial. I am not referring to simple technical advise dealing with language constructs. Those are usually fairly useful and instructive. I am talking about the &#8220;how to design software&#8221; examples that almost always end up with the &#8220;employee / company / widget&#8221; examples that are far and away too simple and straight forward, and almost never happen in real life.</p>
<p>Second, developers notoriously have difficulty eking out funds and resources from business minded management. This is by no means trying to suggest that business folks are wrong for questioning the validity of programming resources; in fact, this is the perfect check-and-balance for IT departments that helps those IT folks rethink and reevaluate their technical decisions. Developers are all too quick to jump on a technical band wagon just because it is the cool thing to do. The bottom line is does it really make good business sense?</p>
<p>Third, training is critical to develop programmer skills. The best training, in my opinion, is pair programming in an apprentice type atmosphere. We have somewhat lost focus on apprentice programs. Many years ago, these programs were in place to bring junior craftsman up to speed and develop them into tomorrows artisan. Blacksmiths, carpenters, bricklayers, gardeners, and just about any trade you can think of worked like this. Now, we tend to think that if someone has a degree that makes them qualified to understand proper software construction, and this couldn&#8217;t be farther from the truth. College gives us the tools to understand construction, but it doesn&#8217;t give us the blueprints to build systems. Those skills are only obtained by actually building those systems under the guidance of an experienced craftsman, and without the experienced craftsman to show us the ropes we are left to trial-n-error and can end up creating some very bad software construction habits.</p>
<p>Fourth, as with any bad habit, bad programming habits are difficult to break. It is much easier to go about your daily development chores building software the same way you did yesterday and the day before, right or wrong. In the case Cut-n-Paste, for example, programmers replicate bad design making maintenance an increasingly difficult task and making software more unreliable instead of better over version releases. This is a huge problem and one that is often unnoticed until it is too late.</p>
<h2>Summary</h2>
<p>The Solution to all these issues is to have highly skilled developers mentor unskilled ones. Make sure all the development staff has adequate training and tools to do their jobs properly; certainly, but there is simply no substitute for having a true architect to show junior developers the right and wrong way to create software systems. Senior team members create a good atmosphere for development instilling good habits into their team members. Most good habits don&#8217;t cost much, if any, additional monetary investment. Good habits are not software tools (such as CASE tools); rather, good habits are how you approach the development processes. Great software can be built using Notepad and index cards just as easily as the Rational Software Suite with Visual Studio. The best ally a development team has is the willingness of it&#8217;s own staff to work well together, communicate, and train one another. This requires no expensive development tools so there isn&#8217;t really anything to prevent good software development, so why no just do it right!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blairdev.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blairdev.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blairdev.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blairdev.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/blairdev.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/blairdev.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/blairdev.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/blairdev.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blairdev.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blairdev.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blairdev.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blairdev.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blairdev.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blairdev.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=80&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blairdev.wordpress.com/2009/10/05/building-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c8a3c140447b4a4502874ecee4f8848f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">blairdev</media:title>
		</media:content>
	</item>
		<item>
		<title>Coding Considerations</title>
		<link>http://blairdev.wordpress.com/2009/09/14/coding-considerations/</link>
		<comments>http://blairdev.wordpress.com/2009/09/14/coding-considerations/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 19:07:02 +0000</pubDate>
		<dc:creator>blairdev</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://blairdev.wordpress.com/?p=62</guid>
		<description><![CDATA[Introduction This might also be called &#8220;Refactorings&#8221; but I consider all the the following points no matter whether I am building new software or refactoring old software. This has nothing to do with software patterns even though many of the refactorings are considered pattern-like. If you have not read Martin Fowler&#8217;s &#8220;Refactoring: Improving the Design [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=62&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Introduction</h3>
<p>This might also be called &#8220;Refactorings&#8221; but I consider all the the following points no matter whether I am building new software or refactoring old software. This has nothing to do with software patterns even though many of the refactorings are considered pattern-like. If you have not read Martin Fowler&#8217;s &#8220;Refactoring: Improving the Design of Existing Code&#8221; then you ought to. You also need to read Dave West&#8217;s &#8220;Object Thinking&#8221; but it is a bit abstract for some folks. Most of these considerations that follow come directly from these texts. There is another text my Joshua Kerievsky called &#8220;Refactoring To Patterns&#8221; that concentrates more on software design patterns. It is a great book and if you want a better understanding of refactoring then make sure and pick up this book as well.</p>
<p>All the metrics and software engineering that can be discovered, studied, and revealed still can not take the place of experience. In fact, experience is just about the only commodity that results in successful software projects. I also firmly believe that developers need to be mentored in an apprentice type of &#8220;farm system&#8221; to develop their talents properly and in a timely fashion. This, I believe, is truly the only way to build a successful software team of developers.</p>
<h3>Tests</h3>
<p>First and foremost, building test suites that are self checking is critical to refactoring and provides us the confidence to go forward with our refactoring efforts. Having test suites to check small changes we make to the code base makes it fairly easy to find bugs we introduce during refactoring. So, take the extra time and build good tests! It will pay off in the long run, I promise.</p>
<h3>Refactorings &#8211; I keep handy</h3>
<ul>
<li>Always use clear and descriptive variable names. If you find yourself commenting on what a variable does then you probably need to rethink what you have named the variable.</li>
<li>Strive to use short methods. This keeps complex code to a minimum.</li>
<li>Eliminate duplicate code.</li>
<li>If you are commenting you methods a lot then you should reconsider how to make your code more readable.</li>
<li>Do not cut and paste code if at all possible. If you find yourself doing this then you should take a close look at why and determine if it is possible to create a method and call that method.</li>
<li>Do not be afraid to develop small classes to take the work load out of bigger classes.</li>
<li>Use short, well defined methods with a single purpose (reflected in the method name)</li>
<li>Use expressions instead of temporary variables</li>
<li>Replace temporary variables with methods</li>
<li>Replace long methods with a method object</li>
<li>Use getters and setters for all private data</li>
<li>Only use Setters when a property is not read only</li>
<li>Use data classes instead of records</li>
<li>Use <em>Breaks </em>or <em>Returns</em> instead of control flags to simplify methods</li>
<li>Use <em>Nullable </em>objects to test for use</li>
<li>Use Objects for method parameters to pass lots of information</li>
<li>Set all methods that are not used outside of object to <em>private</em></li>
</ul>
<h3>Metrics &#8211; good to keep in mind</h3>
<ul>
<li>Fewer than 100 classes for a project</li>
<li>Fewer than 1000 classes for an entire business domain</li>
<li>Number of development iterations should be at least three (3)</li>
<li>Throw away 25% of code on each iteration</li>
<li>Maximum of 15 lines of code per method</li>
<li>Average of 12 methods per class</li>
<li>Try to totally eliminate nested conditionals and case statements</li>
<li>Try to discover objects, responsibilities, and collaborators using CRC cards</li>
<li>Think of all objects in terms of &#8220;human&#8221; attributes and responsibilities</li>
<li>Everything is an object</li>
<li>Objects must be composable (able to break code about and but back together)</li>
<li>Distributed cooperation and communication replaces centralized control</li>
<li>Assemble object as in theater: An example is that one person play is very simple to produce but requires a very talented actor.</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blairdev.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blairdev.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blairdev.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blairdev.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/blairdev.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/blairdev.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/blairdev.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/blairdev.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blairdev.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blairdev.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blairdev.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blairdev.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blairdev.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blairdev.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=62&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blairdev.wordpress.com/2009/09/14/coding-considerations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c8a3c140447b4a4502874ecee4f8848f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">blairdev</media:title>
		</media:content>
	</item>
		<item>
		<title>String vs StringBuilder</title>
		<link>http://blairdev.wordpress.com/2009/09/09/string-vs-stringbuilder/</link>
		<comments>http://blairdev.wordpress.com/2009/09/09/string-vs-stringbuilder/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 11:09:56 +0000</pubDate>
		<dc:creator>blairdev</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://blairdev.wordpress.com/?p=27</guid>
		<description><![CDATA[An Immutable object is an object that can not be altered once it is created. A string in the .NET Framework is Immutable. Once it is created, you can not change it. So, for example, to display environmental variables you might be tempted to use the following code: string EnvironmentData = ""; IDictionary environmentVariables = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=27&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>An Immutable object is an object that can not be altered once it is created. A string in the .NET Framework is Immutable. Once it is created, you can not change it. So,  for example, to display environmental variables you might be tempted to use the following code:</p>
<pre> string EnvironmentData = "";
 IDictionary environmentVariables = Environment.GetEnvironmentVariables();
 foreach (DictionaryEntry de in environmentVariables)
 {
    EnvironmentData += "KEY: " + de.Key + " - VALUE: " + de.Value + "\n";
 }
 Console.WriteLine(EnvironmentData);</pre>
<p>The problem is that every time the string variable <em>EnvironmentData</em> is updated, a new copy is actually created and the old string is then copied into the new copy. This is due to the Immutable <em>string</em> object. Alternatively, we could have used the <em>StringBuilder </em>object to boost performance in this situation. In fact, any time a string is changed more than twice I always use the <em>StringBuilder </em>object:</p>
<pre> StringBuilder EnvironmentData = new StringBuilder();
 IDictionary environmentVariables = Environment.GetEnvironmentVariables();
 foreach (DictionaryEntry de in environmentVariables)
 {
    EnvironmentData.Append("KEY: " + de.Key + " - VALUE: " + de.Value + "\n");
 }
 Console.WriteLine(EnvironmentData);</pre>
<p>The performance increase is measurable over many iterations and while it doesn&#8217;t seem like much, it adds up over the enterprise; not to mention, it makes for good programming. Try this none sense code to get an idea of performance savings using <em>StringBuilder</em>:</p>
<pre>Console.WriteLine(DateTime.Now.ToString());
 string FileData = "";
 for (int i = 0; i &lt; 100000; i++)
    FileData += "HELLO";

 Console.WriteLine(DateTime.Now.ToString());
 StringBuilder FileData2 = new StringBuilder();
 for (int i = 0; i &lt; 100000; i++)
    FileData2.Append(i.ToString());

 Console.WriteLine(DateTime.Now.ToString());</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blairdev.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blairdev.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blairdev.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blairdev.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/blairdev.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/blairdev.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/blairdev.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/blairdev.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blairdev.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blairdev.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blairdev.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blairdev.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blairdev.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blairdev.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=27&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blairdev.wordpress.com/2009/09/09/string-vs-stringbuilder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c8a3c140447b4a4502874ecee4f8848f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">blairdev</media:title>
		</media:content>
	</item>
		<item>
		<title>Ignorance</title>
		<link>http://blairdev.wordpress.com/2009/09/09/ignorance/</link>
		<comments>http://blairdev.wordpress.com/2009/09/09/ignorance/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 00:36:40 +0000</pubDate>
		<dc:creator>blairdev</dc:creator>
				<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://blairdev.wordpress.com/?p=36</guid>
		<description><![CDATA[&#8220;The greatest ignorance is to reject something you know nothing about&#8221; &#8211; unknown &#8220;If you think education is expensive, try ignorance&#8221; &#8211; Derek Bok &#8220;There is nothing more frightful than ignorance in action&#8221; &#8211; Johann Wolfgang von Goethe &#8220;Being ignorant is not as much a shame, as being unwilling to learn&#8221; &#8211; Benjamin Franklin &#8220;He [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=36&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>&#8220;The greatest ignorance is to reject something you know nothing about&#8221; &#8211; unknown</p>
<p>&#8220;If you think education is expensive, try ignorance&#8221; &#8211; Derek Bok</p>
<p>&#8220;There is nothing more frightful than ignorance in action&#8221; &#8211; Johann Wolfgang von Goethe</p>
<p>&#8220;Being ignorant is not as much a shame, as being unwilling to learn&#8221; &#8211; Benjamin Franklin</p>
<p>&#8220;He must be very ignorant for he answers every question he is asked&#8221; &#8211; Voltaire</p>
<p>“The recipe for perpetual ignorance is: Be satisfied with your opinions and content with your knowledge.” &#8211; Elbert Hubbard</p>
<p>&#8220;Fear always springs from ignorance&#8221; &#8211; Ralph Waldo Emerson</p>
<p>“Nothing in the world is more dangerous than a sincere ignorance and conscientious stupidity.” &#8211; Martin Luther King, Jr.</p>
<p>&#8230; and to give stupidity a say in the matter:<br />
&#8220;Stupidity is like nuclear power; it can be used for good or evil&#8221; &#8211; Dilbert</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blairdev.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blairdev.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blairdev.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blairdev.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/blairdev.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/blairdev.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/blairdev.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/blairdev.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blairdev.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blairdev.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blairdev.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blairdev.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blairdev.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blairdev.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=36&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blairdev.wordpress.com/2009/09/09/ignorance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c8a3c140447b4a4502874ecee4f8848f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">blairdev</media:title>
		</media:content>
	</item>
		<item>
		<title>Microsoft Naming Guidelines</title>
		<link>http://blairdev.wordpress.com/2009/09/07/microsoft-naming-guidelines/</link>
		<comments>http://blairdev.wordpress.com/2009/09/07/microsoft-naming-guidelines/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 15:42:21 +0000</pubDate>
		<dc:creator>blairdev</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Notebook]]></category>

		<guid isPermaLink="false">http://blairdev.wordpress.com/?p=38</guid>
		<description><![CDATA[http://msdn.microsoft.com/en-us/library/xzf533w0%28VS.71%29.aspx Pascal case The first letter in the identifier and the first letter of each subsequent concatenated word are capitalized. You can use Pascal case for identifiers of three or more characters. For example: BackColor Camel case The first letter of an identifier is lowercase and the first letter of each subsequent concatenated word is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=38&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a class="alignleft" title="Microsoft Naming Guidelines" href="http://msdn.microsoft.com/en-us/library/xzf533w0%28VS.71%29.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/xzf533w0%28VS.71%29.aspx</a></p>
<h2>Pascal case</h2>
<p>The first letter in the identifier and the first letter of each subsequent concatenated word are capitalized. You can use Pascal case for identifiers of three or more characters. For example:</p>
<pre>BackColor</pre>
<h2>Camel case</h2>
<p>The first letter of an identifier is lowercase and the first letter of each subsequent concatenated word is capitalized. For example: <em><br />
</em></p>
<pre>backColor</pre>
<h2>Uppercase</h2>
<p>All letters in the identifier are capitalized. Use this convention only for identifiers that consist of two or fewer letters. For example:</p>
<pre>System.IO
System.Web.UI</pre>
<h2>Namespace Naming Guidelines</h2>
<p>CompanyName.TechnologyName[.Feature][.Design]<br />
For Example:</p>
<pre>Microsoft.Media
Microsoft.Media.Design</pre>
<h2>Class Naming Guidelines</h2>
<p>The following rules outline the guidelines for naming classes:</p>
<ul>
<li>Use a noun or noun phrase to name a class.</li>
<li> Use Pascal case.</li>
<li> Use abbreviations sparingly.</li>
<li> Do not use a type prefix, such as C for class, on a class name. For example, use the class name FileStream rather than CFileStream.</li>
<li> Do not use the underscore character (_).</li>
<li> Occasionally, it is necessary to provide a class name that begins with the letter I, even though the class is not an interface. This is appropriate as long as I is the first letter of an entire word that is a part of the class name. For example, the class name IdentityStore is appropriate.</li>
<li> Where appropriate, use a compound word to name a derived class. The second part of the derived class&#8217;s name should be the name of the base class. For example, ApplicationException is an appropriate name for a class derived from a class named Exception, because ApplicationException is a kind of Exception. Use reasonable judgment in applying this rule. For example, Button is an appropriate name for a class derived from Control. Although a button is a kind of control, making Control a part of the class name would lengthen the name unnecessarily.</li>
</ul>
<p>For Example:</p>
<pre>public class FileStream
public class Button
public class String</pre>
<h2>Interface Naming Guidelines</h2>
<p>The following rules outline the naming guidelines for interfaces:<br />
* Name interfaces with nouns or noun phrases, or adjectives that describe behavior. For example, the interface name IComponent uses a descriptive noun. The interface name ICustomAttributeProvider uses a noun phrase. The name IPersistable uses an adjective.</p>
<ul>
<li> Use Pascal case.</li>
<li> Use abbreviations sparingly.</li>
<li> Prefix interface names with the letter I, to indicate that the type is an interface.</li>
<li> Use similar names when you define a class/interface pair where the class is a standard implementation of the interface. The names should differ only by the letter I prefix on the interface name.</li>
<li> Do not use the underscore character (_).</li>
</ul>
<p>The following are examples of correctly named interfaces.</p>
<pre>public interface IServiceProvider
public interface IFormatable</pre>
<h2>Attribute Naming Guidelines</h2>
<p>You should always add the suffix Attribute to custom attribute classes. The following is an example of a correctly named attribute class.</p>
<pre>public class ObsoleteAttribute{}</pre>
<h2>Enumeration Type Naming Guidelines</h2>
<p>The enumeration (Enum) value type inherits from the Enum Class. The following rules outline the naming guidelines for enumerations:</p>
<ul>
<li> Use Pascal case for Enum types and value names.</li>
<li> Use abbreviations sparingly.</li>
<li> Do not use an Enum suffix on Enum type names.</li>
<li> Use a singular name for most Enum types, but use a plural name for Enum types that are bit fields.</li>
<li> Always add the FlagsAttribute to a bit field Enum type.</li>
</ul>
<p>An enumeration should have FlagsAttribute present only if each value defined in the enumeration is a power of two, or a combination of defined values.</p>
<pre>[FlagsAttribute]
public enum DaysEnumNeedsFlags
{
   None     = 0,
   Monday    = 1,
   Tuesday   = 2,
   Wednesday = 4,
   Thursday  = 8,
   Friday    = 16,
   All       = Monday| Tuesday | Wednesday | Thursday | Friday
 }</pre>
<h2>Static Field Naming Guidelines</h2>
<p>The following rules outline the naming guidelines for static fields:</p>
<ul>
<li> Use nouns, noun phrases, or abbreviations of nouns to name static fields.</li>
<li> Use Pascal case.</li>
<li> Do not use a Hungarian notation prefix on static field names.</li>
<li> It is recommended that you use static properties instead of public static fields whenever possible.</li>
</ul>
<h2>Parameter Naming Guidelines</h2>
<p>It is important to carefully follow these parameter naming guidelines because visual design tools that provide context sensitive help and class browsing functionality display method parameter names to users in the designer. The following rules outline the naming guidelines for parameters:</p>
<ul>
<li> Use camel case for parameter names.</li>
<li> Use descriptive parameter names. Parameter names should be descriptive enough that the name of the parameter and its type can be used to determine its meaning in most scenarios. For example, visual design tools that provide context sensitive help display method parameters to the developer as they type. The parameter names should be descriptive enough in this scenario to allow the developer to supply the correct parameters.</li>
<li> Use names that describe a parameter&#8217;s meaning rather than names that describe a parameter&#8217;s type. Development tools should provide meaningful information about a parameter&#8217;s type. Therefore, a parameter&#8217;s name can be put to better use by describing meaning. Use type-based parameter names sparingly and only where it is appropriate.</li>
<li> Do not use reserved parameters. Reserved parameters are private parameters that might be exposed in a future version if they are needed. Instead, if more data is needed in a future version of your class library, add a new overload for a method.</li>
<li> Do not prefix parameter names with Hungarian type notation.</li>
<li> The following are examples of correctly named parameters.</li>
</ul>
<p>For Example:</p>
<pre>Type GetType(string typeName)
string Format(string format, object[] args)</pre>
<h2>Method Naming Guidelines</h2>
<p>The following rules outline the naming guidelines for methods:</p>
<ul>
<li> Use verbs or verb phrases to name methods.</li>
<li> Use Pascal case.</li>
</ul>
<p>The following are examples of correctly named methods.</p>
<pre>RemoveAll()
GetCharArray()
Invoke()</pre>
<h2>Property Naming Guidelines</h2>
<p>The following rules outline the naming guidelines for properties:</p>
<ul>
<li> Use a noun or noun phrase to name properties.</li>
<li> Use Pascal case.</li>
<li> Do not use Hungarian notation.</li>
<li> Consider creating a property with the same name as its underlying type. For example, if you declare a property named Color, the type of the property should likewise be Color. See the example later in this topic.</li>
</ul>
<p>The following code example illustrates correct property naming.</p>
<pre>public class SampleClass
{
   public Color BackColor
   {
      // Code for Get and Set accessors goes here.
   }
}
public enum Color
{
   // Insert code for Enum here.
}
public class Control
{
   public Color Color
   {
      get {// Insert code here.}
      set {// Insert code here.}
   }
}</pre>
<h2>Event Naming Guidelines</h2>
<p>The following rules outline the naming guidelines for events:</p>
<ul>
<li> Use Pascal case.</li>
<li> Do not use Hungarian notation.</li>
<li> Use an EventHandler suffix on event handler names.</li>
<li> Specify two parameters named sender and e. The sender parameter represents the object that raised the event. The sender parameter is always of type object, even if it is possible to use a more specific type. The state associated with the event is encapsulated in an instance of an event class named e. Use an appropriate and specific event class for the e parameter type.</li>
<li> Name an event argument class with the EventArgs suffix.</li>
<li> Consider naming events with a verb. For example, correctly named event names include Clicked, Painting, and DroppedDown.</li>
<li> Use a gerund (the &#8220;ing&#8221; form of a verb) to create an event name that expresses the concept of pre-event, and a past-tense verb to represent post-event. For example, a Close event that can be canceled should have a Closing event and a Closed event. Do not use the BeforeXxx/AfterXxx naming pattern.</li>
<li> Do not use a prefix or suffix on the event declaration on the type. For example, use Close instead of OnClose.</li>
<li> In general, you should provide a protected method called OnXxx on types with events that can be overridden in a derived class. This method should only have the event parameter e, because the sender is always the instance of the type.</li>
</ul>
<p>The following example illustrates an event handler with an appropriate name and parameters.</p>
<pre>public delegate void MouseEventHandler(object sender, MouseEventArgs e);
public class MouseEventArgs : EventArgs
{
   int x;
   int y;
   public MouseEventArgs(int x, int y)
   { this.x = x; this.y = y; }
   public int X { get { return x; } }
   public int Y { get { return y; } }
}</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blairdev.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blairdev.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blairdev.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blairdev.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/blairdev.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/blairdev.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/blairdev.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/blairdev.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blairdev.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blairdev.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blairdev.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blairdev.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blairdev.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blairdev.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=38&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blairdev.wordpress.com/2009/09/07/microsoft-naming-guidelines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c8a3c140447b4a4502874ecee4f8848f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">blairdev</media:title>
		</media:content>
	</item>
		<item>
		<title>Singleton Data Connection</title>
		<link>http://blairdev.wordpress.com/2009/09/01/singleton-data-connection/</link>
		<comments>http://blairdev.wordpress.com/2009/09/01/singleton-data-connection/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 16:45:23 +0000</pubDate>
		<dc:creator>blairdev</dc:creator>
				<category><![CDATA[Notebook]]></category>
		<category><![CDATA[Singleton]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blairdev.wordpress.com/?p=12</guid>
		<description><![CDATA[There are several reasons I believe it is better to open the connection and close it as soon as possible rather than use the Singleton Pattern.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=12&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p dir="ltr">
<div>I have run across more than one developer that insisted on trying to code for a singleton data connection to a MS SqlServer database. I don&#8217;t believe this is a reasonable solution regardless if it is a multi-threaded environment or not. There are several reasons I believe it is better to open the connection and close it as soon as possible.</div>
<ul>
<li>Database connection pooling helps to take care of finding an available connection and reduce time instead making a new connection</li>
<li>It is just too much trouble to code for multiple threads access the connection at once</li>
<li>If the application using the open connection remains idle for a while, the connection could be forced closed by the system causing errors unless you check for an open connection every time you use it.</li>
</ul>
<div>There are many reasons to use the Singleton pattern but using it for a database connection in not one of them, in my opinion, as long as the database connection pooling is available and active. If you have to use a singleton connection then make sure and code to recover from the connection being lost/dropped.</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blairdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blairdev.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blairdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blairdev.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/blairdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/blairdev.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/blairdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/blairdev.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blairdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blairdev.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blairdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blairdev.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blairdev.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blairdev.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=12&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blairdev.wordpress.com/2009/09/01/singleton-data-connection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c8a3c140447b4a4502874ecee4f8848f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">blairdev</media:title>
		</media:content>
	</item>
		<item>
		<title>Exceptions</title>
		<link>http://blairdev.wordpress.com/2009/09/01/exceptions/</link>
		<comments>http://blairdev.wordpress.com/2009/09/01/exceptions/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 16:41:36 +0000</pubDate>
		<dc:creator>blairdev</dc:creator>
				<category><![CDATA[Notebook]]></category>
		<category><![CDATA[Exceptions]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blairdev.wordpress.com/?p=5</guid>
		<description><![CDATA[I use exceptions for handling critical system errors, abnormal behavior, and the unknown.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=5&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div dir="ltr">
<div>I encounter other programmer&#8217;s code on almost a daily basis. I find all kinds of styles and techniques that I find impossible to follow and understand. One such sytle is using Exceptions (no matter the language) for functional flow. What that does is no different than placing a bunch of GO TOs in the code every time a functional issue is hit. Don&#8217;t get me wrong, exceptions are critical to proper coding, but ONLY if used properly. Exception should be used for abnormal conditions. Here is the way I like to use exceptions: <span>Exception should not be used to control the flow of execution just because someone entered a wrong number into a text box or scanned the wrong barcode on a label. Scanning incorrect barcodes are errors but they are not critical or abnormal and should be dealt with by coding techniques and language constructs.</span></div>
<div><span><br />
</span></div>
<div><span>A good example from &#8220;Microsoft .Net Framework &#8211; Application Development Foundation&#8221; by Tony Northrup is this: the application is reading data from a removable disk and someone removes the disk in the middle of the read. That is an &#8220;unexpected&#8221; event and should be handled by an exception. It is not; however, an exception if you open the file and the contents is not formatted correctly. This is to be expected; or at least anticipated, and can easily be handled using language constructs. </span></div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blairdev.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blairdev.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blairdev.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blairdev.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/blairdev.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/blairdev.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/blairdev.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/blairdev.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blairdev.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blairdev.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blairdev.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blairdev.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blairdev.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blairdev.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blairdev.wordpress.com&amp;blog=9256326&amp;post=5&amp;subd=blairdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blairdev.wordpress.com/2009/09/01/exceptions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c8a3c140447b4a4502874ecee4f8848f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">blairdev</media:title>
		</media:content>
	</item>
	</channel>
</rss>
