<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>The Software Purist</title>
	
	<link>http://www.softwarepurist.com/blog</link>
	<description />
	<lastBuildDate>Thu, 21 Jul 2011 23:53:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/SoftwarePurist" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="softwarepurist" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bloglines.com/sub/http://feeds.feedburner.com/SoftwarePurist" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.newsalloy.com/?rss=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://www.newsalloy.com/subrss3.gif">Subscribe with NewsAlloy</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://download.attensa.com/app/get_attensa.html?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://www.attensa.com/blogs/attensa/WindowsLiveWriter/BadgeredintoBadges_10C02/attensa_feed_button5.gif">Subscribe with Attensa for Outlook</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.podcastready.com/oneclick_bookmark.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://www.podcastready.com/images/podcastready_button.gif">Subscribe with Podcast Ready</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.flurry.com/pushRssFeed.do?r=fb&amp;url=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://www.flurry.com/images/flurry_rss_logo2.gif">Subscribe with Flurry</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.wikio.com/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.dailyrotation.com/index.php?feed=http%3A%2F%2Ffeeds.feedburner.com%2FSoftwarePurist" src="http://www.dailyrotation.com/rss-dr2.gif">Subscribe with Daily Rotation</feedburner:feedFlare><item>
		<title>How to Create a Windows 7 Kiosk</title>
		<link>http://www.softwarepurist.com/blog/index.php/how-to-create-a-windows-7-kiosk/</link>
		<comments>http://www.softwarepurist.com/blog/index.php/how-to-create-a-windows-7-kiosk/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 23:51:46 +0000</pubDate>
		<dc:creator>softwarepurist</dc:creator>
				<category><![CDATA[Developers]]></category>
		<category><![CDATA[Kiosk]]></category>
		<category><![CDATA[regedit]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://www.softwarepurist.com/blog/?p=277</guid>
		<description><![CDATA[How to Create a Windows 7 Kiosk]]></description>
			<content:encoded><![CDATA[<p>A friend of mine recently posted an article on how to create a Windows 7 Kiosk, which would basically restrict a user to running only a particular program, and provide no shell access or access to windows explorer. The original article is in Russian and can be found here: <a href="http://hippocat73.livejournal.com/74203.html">http://hippocat73.livejournal.com/74203.html</a>. Fortunately, through the magic of Google Translate and my limited understanding of Russian, I&#8217;ve translated the instructions to English.</p>
<p>It starts out by saying that he recently learned, and is publishing, so he doesn&#8217;t forget the instructions. This can cover the case where you have to put a payment terminal or control program, but done in such a way as to ensure that nothing more than what can be seen on the computer screen can be accessed. Performing this action on Linux or Unix is very simple, just replace the current window manager. To do this on Windows, perform the following steps:</p>
<ol>
<li>Create a user which will use the kiosk. Give him administrative privileges.</li>
<li>Login as this user.</li>
<li>Change the window manager by default on a program that will completely own the session:</li>
<ol>
<li>run regedit</li>
<li>Find the following key: HKEY_CURRENT_USER\Software\Microsoft\WindowsNT\CurrentVersion\Winlogon</li>
<li>Add a new field of type string named Shell and set its value in the full name of your program for example: C:\Myprog\myprog.exe</li>
<li>Close the session and login again. Instead of the usual screen, this should start our program and nothing else should be on the screen of should exist (no desktop or Start button). When you close the program you should just see a black screen. This is very useful if the program closes the output at the same time as the Windows session.</li>
</ol>
</li>
<li>Now all polish, as the primary administrator login and drop kiosk user to normal levels. It should not be an administrator. Then, in Windows 7 is the mode of parental control. Include it (for natural kiosk user) and allow run only one program, then for user, all attempts to start something else will be prevented and the fact all, the process can be automated to a simple script if you need to configure a lot of machines.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarepurist.com/blog/index.php/how-to-create-a-windows-7-kiosk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Conditional Compilation in Java</title>
		<link>http://www.softwarepurist.com/blog/index.php/conditional-compilation-in-java/</link>
		<comments>http://www.softwarepurist.com/blog/index.php/conditional-compilation-in-java/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 23:28:05 +0000</pubDate>
		<dc:creator>softwarepurist</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Conditional Compilation]]></category>

		<guid isPermaLink="false">http://www.softwarepurist.com/blog/?p=270</guid>
		<description><![CDATA[Conditional Compilation in Java.]]></description>
			<content:encoded><![CDATA[<p>I wanted to share a trick I learned a while back, that is pretty useful. Personally, I&#8217;m not a fan of including code in your executable/bytecode that is never used, because it has the risk of exposing additional implementation, and generally makes for larger DLLs/Jars. One nice thing I can say about C# is that they did not completely remove the idea of conditional compilation. In C#, you can do the following:</p>
<p><code><br />
#define LETS_DANCE</p>
<p>...</p>
<p>#if LETS_DANCE<br />
// ... do something ...<br />
#endif<br />
</code></p>
<p>However, C#&#8217;s conditional compilation is completely restricted to only being able to define a boolean, where the existence of the preprocessor symbol means it exists, and otherwise, it doesn&#8217;t. Makes sense. Conditional compilation without all the nasty misuses of them you see in C++ programs. Seems to be the best of both worlds and an obvious leg up on Java, right?</p>
<p>Well, actually not really. Turns out that Java has supported something similar since day one, also. In Java, the equivalent is this:</p>
<p><code><br />
public static final LETS_DANCE = false;</p>
<p>...</p>
<p>if (LETS_DANCE)<br />
{<br />
// ... do something ...<br />
}<br />
#endif<br />
</code></p>
<p>Why is this guaranteed to work and not include the unreachable code? Turns out there is an important note in Java. Java will not output code that is obviously unreachable. To be obviously unreachable it needs to be known at compile time as a static final constant variable. So, there you go. Definitely a useful thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarepurist.com/blog/index.php/conditional-compilation-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Branching in Mercurial</title>
		<link>http://www.softwarepurist.com/blog/index.php/branching-in-mercurial/</link>
		<comments>http://www.softwarepurist.com/blog/index.php/branching-in-mercurial/#comments</comments>
		<pubDate>Mon, 30 May 2011 07:18:11 +0000</pubDate>
		<dc:creator>softwarepurist</dc:creator>
				<category><![CDATA[Mercurial]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[Source Control]]></category>

		<guid isPermaLink="false">http://www.softwarepurist.com/blog/?p=267</guid>
		<description><![CDATA[Branching in Mercurial]]></description>
			<content:encoded><![CDATA[<p>Hey all. It&#8217;s been a while. After many years using revision control systems with the merge or lock models, I started using Mercurial a while back. I&#8217;ve used it a bit before, but mostly have been using SVN and TFS lately for my personal and professional projects. SVN and TFS each have their own problems. You can find things that one is good at and the other isn&#8217;t, but this post isn&#8217;t really about that. One day I may make a long write up about how flawed each of these revision control systems are. Not today.</p>
<p>The main thing here is that merging is often seen as a hell-ish operation, and distributed version control systems seems to make the task much easier. That being said, when working with Mercurial, I was using hg clone to make a copy of the repository and push/pull changes, instead of branching, which seems logical given the way Mercurial works. While, this works, it&#8217;s not the best way to create a branch. Now that I&#8217;ve realized this mistake, I found a good article that goes through the options in a bit more detail:</p>
<p>http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarepurist.com/blog/index.php/branching-in-mercurial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic: The New C# Keyword That Has Abuse Written All Over It</title>
		<link>http://www.softwarepurist.com/blog/index.php/dynamic-the-new-c-keyword-that-has-abuse-written-all-over-it/</link>
		<comments>http://www.softwarepurist.com/blog/index.php/dynamic-the-new-c-keyword-that-has-abuse-written-all-over-it/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 06:00:55 +0000</pubDate>
		<dc:creator>softwarepurist</dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.softwarepurist.com/blog/?p=264</guid>
		<description><![CDATA[Dynamic: The New C# Keyword That Has Abuse Written All Over It]]></description>
			<content:encoded><![CDATA[<p>Dynamic is a new keyword that was introduced in C# 4.0. Thankfully, it hasn&#8217;t gotten a ton of press, but I can see it paving the way for all sorts of new types of abuse. By now, you&#8217;re probably familiar with my thoughts on the var keyword. Dynamic takes this one step further, by dynamically binding the class type at runtime, and determining if method calls are legal, also at runtime. Here&#8217;s an example:</p>
<p><code><br />
public void MyMethod(dynamic param)<br />
{<br />
    param.Call();<br />
}<br />
</code></p>
<p>So, let&#8217;s say you pass in an instance of a class which has the method named Call. All is well, Call() will be called, albeit with a performance penalty.</p>
<p>Now, consider what happens if you pass in an instance of a class for which Call() doesn&#8217;t exist. It will, instead, throw an exception, which essentially states that Call() doesn&#8217;t exist for this type.</p>
<p>So, what&#8217;s the problem? Very simple. You&#8217;re taking a situation where you can enlist the compiler&#8217;s help, and instead pushing it off to runtime, which entails discovering it later than necessary, in some cases, much later. This increases risk and potentially increases the time to fix, since we know that at each stage later that a bug is discovered, the more expensive it is to fix. Problem 2 is that there is absolutely a performance penalty. In a lot of cases, these penalties are no so noticeable, but spread out through an entire application, they can make a serious impact. I have seen poorly written C# applications which made both heavy and improper usage of reflection that easily can operate an order of magnitude slower than well-written one which takes advantage of the type system.</p>
<p>Avoid dynamic in most cases. Use it for cases where it really matters. If you find yourself needing a lot of dynamic behavior, you are more well-suited to using a scripting language like Python or Ruby, where the syntax will be much cleaner and you don&#8217;t risk so much paradigm mix, therefore creating more understandable code. Otherwise, if you&#8217;re determined to use C#, then use it as the type-safe language that it can be, and don&#8217;t treat the type-system as optional, even if Microsoft got overzealous in feature overload.</p>
<p>What&#8217;s the solution? Instead, make the method look like this:</p>
<p><code><br />
public interface ICall<br />
{<br />
   void Call();<br />
}</p>
<p>public void MyMethod(ICall param)<br />
{<br />
    param.Call();<br />
}<br />
</code></p>
<p>Using generics is also a possible solution. Just remember that when you violate the type system, you are losing the advantages of using a type-safe language.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarepurist.com/blog/index.php/dynamic-the-new-c-keyword-that-has-abuse-written-all-over-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Var/Auto is Ugly and in Some Cases, Downright Evil.</title>
		<link>http://www.softwarepurist.com/blog/index.php/varauto-is-ugly-and-in-some-cases-downright-evil/</link>
		<comments>http://www.softwarepurist.com/blog/index.php/varauto-is-ugly-and-in-some-cases-downright-evil/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 12:57:42 +0000</pubDate>
		<dc:creator>softwarepurist</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[STL]]></category>
		<category><![CDATA[auto]]></category>
		<category><![CDATA[type-safety]]></category>
		<category><![CDATA[var]]></category>

		<guid isPermaLink="false">http://www.softwarepurist.com/blog/?p=257</guid>
		<description><![CDATA[The Software Purist investigates the usage of two keywords from different languages, which effectively serve the same purpose. var in C# and auto in C++.]]></description>
			<content:encoded><![CDATA[<p>In this post, I&#8217;m going to describe a set of keywords, which effectively serve the same purpose. In C#, there is the var keyword. In C++, there is the auto keyword. Effectively, what they let you do is to automatically inter the type of a variable from the context on the right hand side. Here&#8217;s an example, in C#:</p>
<p><code><br />
var myVar = new MyClass();<br />
</code></p>
<p>and an example in C++:</p>
<p><code><br />
auto myVar = MyClass();<br />
</code></p>
<p>The problem I have is, while this allows you a tremendous amount of flexibility, in saving redundant typing, it also potentially nullifies some of the benefits of using a language which supports type safety, because you can do some pretty nasty things which destroy the readability and can potentially introduce some subtle bugs. Worse still, tools like Resharper encourage, potentially poor usages of var. Here&#8217;s another example of the var problem:</p>
<p><code><br />
var myVar = new MyClass().DoThis().DoThat().DoSomethingElse().NowGet();<br />
</code></p>
<p>Ok, what&#8217;s the type? Don&#8217;t know? Me neither. I find this problematic. As such, as I&#8217;d like to establish some guidelines for better usage of var/auto, taking some common use cases. I&#8217;ll probably switch back and forth with examples from C++ and C#, just to illustrate the point. Here we go:</p>
<p>1) Usage case 1:</p>
<p><code><br />
var x = new Y();<br />
</code></p>
<p>I consider this usage a minor evil, even though some like it a lot. Here&#8217;s my major problem: You have type inference on the wrong side. The point of using a language which supports type safety, is, well, you support the type system and let it help you. If you don&#8217;t want that, may I suggest a language that is dynamically typed? It would be nice, if var, instead worked this way:</p>
<p><code><br />
Y x = new infer-this-type();<br />
</code></p>
<p>As a general rule, we would prefer to infer the type that&#8217;s on the right hand side, not the left. This feature is not available in a lot of languages, so for now, I would simply suggest not using var. Go with the old:</p>
<p><code><br />
Y x = new Y();<br />
</code></p>
<p>2) Usage case 2:</p>
<p><code><br />
var x = GetY();<br />
</code></p>
<p>Again, with this one, I prefer not to use var, for the same reason as before, with an added caveat. First, of all, you should avoid using var to avoid typing a simple type. Secondly, you can&#8217;t even figure out what the type is from reading the code. Not good. On a scale of 1 to evil, I consider this a significant evil.</p>
<p>3) Usage case 3:</p>
<p><code><br />
for (typename std::vector<int>::const_iterator iter = container.begin(); iter != container.end(); ++iter)<br />
{<br />
...<br />
}<br />
</code></p>
<p>Becomes:</p>
<p><code><br />
for (auto iter = container.begin(); iter != container.end(); ++iter)<br />
{<br />
...<br />
}<br />
</code></p>
<p>In this case, I can justify using var/auto, so I consider using auto a minor evil. However, C++ has a better mechanism for doing this. It&#8217;s called typedef. For example:</p>
<p><code><br />
typedef typename std::vector<int>::const_iterator MyIter;</p>
<p>for (MyIter iter = container.begin(); iter != container.end(); ++iter)<br />
{<br />
...<br />
}<br />
</code></p>
<p>So, in C++, I have trouble finding ANY usage, where I really like auto. However, in C#, there is no typedef, so I&#8217;m fine with usage of var, in the case of complicated nested classes.</p>
<p><strong>Conclusion</strong></p>
<p>Concluding, as you figured, I don&#8217;t like the usage of var or auto much. In a lot of cases, it is a minor evil. However, there are some major concerns: Readability and subverting some of the redundant checking that the type system supports. In C#, it is sometimes useful to save a lot of typing, due to the lack of the typedef keyword, while in C++, it is rarely useful. In a future article, I will tackle C#&#8217;s dynamic keyword, which I dislike far more than var. Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarepurist.com/blog/index.php/varauto-is-ugly-and-in-some-cases-downright-evil/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>What’s the Best Way to Perform a Lay-off?</title>
		<link>http://www.softwarepurist.com/blog/index.php/whats-the-best-way-to-perform-a-lay-off/</link>
		<comments>http://www.softwarepurist.com/blog/index.php/whats-the-best-way-to-perform-a-lay-off/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 11:21:55 +0000</pubDate>
		<dc:creator>softwarepurist</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.softwarepurist.com/blog/?p=255</guid>
		<description><![CDATA[The Software Purist investigates something that almost every company goes through. With the recession, many companies have gone through lay-offs at one point or another. It is discussed here.]]></description>
			<content:encoded><![CDATA[<p>So, an interesting topic I&#8217;ve been thinking about is lay-offs. Of course, this happens almost everywhere, and is certainly not unknown to the software field. I&#8217;ve witnessed it happening to others, a few times in my career. However, out of respect for the companies I&#8217;ve worked for, and a sense of professionalism, I&#8217;m going to write this and have it be intentionally vague. I apologize ahead of time.</p>
<p>First, let&#8217;s talk about some things I&#8217;ve seen or heard and some Do&#8217;s and Don&#8217;ts:</p>
<p>Do:</p>
<p>1) Give the employees ample time after to collect all remaining stuff on their PCs. Rarely will they sabotage. If they do, IT is expected to have ample backups. If not, the problem is the lack of backups, not the employee&#8217;s desire to sabotage.<br />
2) Be as honest as you can, without opening yourself up to liability. If the employee was really fired and you simply waited for layoff time, it doesn&#8217;t help them professionally to think it was 100% financially motivated.<br />
3) Do give a generous severance package. It really helps a lot with their confidence.<br />
4) Do offer HR services in helping them find a new job.<br />
5) Do offer ways for colleagues to get back in touch with them (less important with sites like LinkedIn now).</p>
<p>Don&#8217;t:</p>
<p>1) Don&#8217;t give public warning ahead of time in a big company meeting, unless you really are intending of laying off the entire company. Otherwise, you will scare a lot of people who weren&#8217;t in danger.<br />
2) Don&#8217;t make promises you can&#8217;t keep to the people who are remaining.<br />
3) Do not refer to the people laid-off as &#8220;the departed&#8221;. It makes them sound like they&#8217;re dead, instead of just not working there anymore.<br />
4) Do not hint that the remaining employees have to work harder. Most likely they already were, that&#8217;s why you kept them.<br />
5) Don&#8217;t do multiple rounds of layoffs, if possible. This encourages your good people to quit. Instead, try to get it all done in one shot, so people can put it past them.</p>
<p>Anyway, this was just a simple bulleted list and is purely opinion. I&#8217;ll be back with more programming stuff, next time. I think it&#8217;s time to tackle some of impure things in C#. Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarepurist.com/blog/index.php/whats-the-best-way-to-perform-a-lay-off/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is a Programming Language Merely Just Syntax?</title>
		<link>http://www.softwarepurist.com/blog/index.php/is-a-programming-language-merely-just-syntax/</link>
		<comments>http://www.softwarepurist.com/blog/index.php/is-a-programming-language-merely-just-syntax/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 14:04:27 +0000</pubDate>
		<dc:creator>softwarepurist</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Developers]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Threading]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[ATL]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[MFC]]></category>
		<category><![CDATA[Object-Oriented]]></category>
		<category><![CDATA[STL]]></category>
		<category><![CDATA[Template Meta-Programming]]></category>

		<guid isPermaLink="false">http://www.softwarepurist.com/blog/?p=247</guid>
		<description><![CDATA[Is a Programming Language Merely Just Syntax? A common statement is challenged.]]></description>
			<content:encoded><![CDATA[<p>I was interviewing a candidate recently, and we were talking about some of the programming languages he claimed to know, which was mainly focused around C++ and C#. We started to discuss some of the types of problems he finds easier to solve in each when he said something I found very misleading: &#8220;A programming language is really just syntax&#8221;. As we talked more, I started to ponder what a shallow understanding of a language this really was. It&#8217;s kind of like questioning whether a dollar is a dollar is a dollar. Smart financial people know that the source of the dollar is very important, and so the utter simplification is misleading.</p>
<p>Before I get too far into this, I will note that if you&#8217;re using .Net, you can get a lot closer to making the premise of the initial argument, because the .Net languages all can support the same APIs. That wasn&#8217;t the case for this individual, as he was using C++, not C++/CLI. With that being said, let&#8217;s get into some of the real substantial differences:</p>
<p>1) The standard libraries that the language supports. I find this to be one of the most underrated aspects of working with a language. I think part of the reason is that when you use some languages (C++) there&#8217;s a large population of programmers who don&#8217;t really make good use of the standard libraries. In my experience, this is often because they sometimes fall into using non-portable APIs, such as Microsoft&#8217;s ATL or MFC instead of STL containers, or libraries that may be considered more suitable for an embedded environment. Anyway, I think this is a critical feature, because, again consider the example of C++: Something as commonly used as XML is not standard. This is almost unfathomable for programmers of languages like Java or C#. Meanwhile, the flipside is .Net, which is immense and becomes very difficult for a developer to be proficient in all of it.</p>
<p>2) Third party libraries the language supports. I would consider this almost as important as the standard libraries issue. Unlike the standard libraries, there&#8217;s a much better chance that the third party libraries have API interfaces to be used in multiple languages. This will be one of the the top things you would consider when choosing the appropriate language for a task.</p>
<p>3) Language Paradigms: This is another feature which gets underrated at times. Does the language properly support Object-Oriented Programming? Template Meta-Programming? Functional? How easily does it support multi-threading? Again, all of these are critical differences between languages which go well beyond syntax.</p>
<p>4) Static Typing or Dynamic Typing or Both (coughC#cough)? With static typing, you can potentially find a lot of structural errors during compile time and need less code coverage during your unit tests. With dynamic typing, you don&#8217;t have these luxuries, but have much better support for rapid development.</p>
<p>5) The tools that are supported for your language.</p>
<p>6) Syntax. I consider this one of the least important differences between languages. It&#8217;s very easy for a professional programmer to adjust to a new syntax, assuming it isn&#8217;t completely <a href="http://en.wikipedia.org/wiki/Brainfuck">nonsensical</a>.</p>
<p>In the end, I think of this like deciphering any sort of spoken or written language. At the end of the day, if you aren&#8217;t able to communicate effectively, then your words are meaningless. This goes far beyond sentence structure. When discussing programming languages, it goes far beyond syntax.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarepurist.com/blog/index.php/is-a-programming-language-merely-just-syntax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happy New Year!</title>
		<link>http://www.softwarepurist.com/blog/index.php/happy-new-year/</link>
		<comments>http://www.softwarepurist.com/blog/index.php/happy-new-year/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 06:04:15 +0000</pubDate>
		<dc:creator>softwarepurist</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Happy New Year]]></category>

		<guid isPermaLink="false">http://www.softwarepurist.com/blog/?p=245</guid>
		<description><![CDATA[Happy New Year!]]></description>
			<content:encoded><![CDATA[<p>First, I wanted to say Happy New Year to everyone. I hope everyone had a wonderful holiday.</p>
<p>I know this blog has been a bit dormant for a little while, but I have a lot of new stuff to write about. Stay tuned.</p>
<p>Looking forward to a great 2011.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarepurist.com/blog/index.php/happy-new-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Binary Searches and the 80/20 Principle</title>
		<link>http://www.softwarepurist.com/blog/index.php/binary-searches/</link>
		<comments>http://www.softwarepurist.com/blog/index.php/binary-searches/#comments</comments>
		<pubDate>Wed, 12 May 2010 11:11:55 +0000</pubDate>
		<dc:creator>softwarepurist</dc:creator>
				<category><![CDATA[Boost]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[STL]]></category>
		<category><![CDATA[80/20]]></category>
		<category><![CDATA[Binary Search]]></category>
		<category><![CDATA[Collections]]></category>
		<category><![CDATA[Containers]]></category>

		<guid isPermaLink="false">http://www.softwarepurist.com/blog/?p=236</guid>
		<description><![CDATA[Only 10% of programmers write a binary search. I delve into why this might be and remove the blame from the developers to where the responsibility really lies.]]></description>
			<content:encoded><![CDATA[<p>I recently came across this post: <a href="http://reprog.wordpress.com/2010/04/19/are-you-one-of-the-10-percent/">http://reprog.wordpress.com/2010/04/19/are-you-one-of-the-10-percent/</a> . I thought this was a very interesting topic, not because a binary search is a particularly interesting algorithm, but because of the realization that only 10% of programmers could get this right on the first try. To test, I did it myself, on paper. I was able to work it out on paper before officially testing it, but I can also see how most people can miss it. It appears to work, according to my tests. Here&#8217;s the solution I came up with:<br />
<br/></p>
<pre class="code">template &lt;class TCollection&gt;
size_t binarySearch(const TCollection&amp; p_collection, const typename TCollection::value_type&amp; p_value)
{
	size_t oldMax = p_collection.size() - 1;
	size_t oldMin = 0;
	size_t newIndex = (oldMax + oldMin) / 2;

	while (oldMin != oldMax)
	{
		if (p_collection[newIndex] &gt; p_value)
		{
			if (oldMax == newIndex)
			{
				break;
			} // end if

			oldMax = newIndex;
			newIndex = (oldMax + oldMin) / 2;
		}
		else if (p_collection[newIndex] &lt; p_value)
		{
			if (oldMin == newIndex)
			{
				break;
			} // end if

			oldMin = newIndex;
			newIndex = (oldMax + oldMin + 1) / 2;
		}
		else
		{
			return newIndex;
		} // end if
	} // end while

	return size_t(-1);
} // end binarySearch

void test()
{
	std::vector&lt;int&gt; collection;
	collection.push_back(1);
	collection.push_back(2);
	collection.push_back(3);
	collection.push_back(5);
	collection.push_back(6);
	collection.push_back(7);
	collection.push_back(9);
	collection.push_back(10);

	assert(binarySearch(collection, 0) == size_t(-1));
	assert(binarySearch(collection, 1) == 0);
	assert(binarySearch(collection, 2) == 1);
	assert(binarySearch(collection, 3) == 2);
	assert(binarySearch(collection, 4) == size_t(-1));
	assert(binarySearch(collection, 5) == 3);
	assert(binarySearch(collection, 6) == 4);
	assert(binarySearch(collection, 7) == 5);
	assert(binarySearch(collection, 8 ) == size_t(-1));
	assert(binarySearch(collection, 9) == 6);
	assert(binarySearch(collection, 10) == 7);
	assert(binarySearch(collection, 11) == size_t(-1));
} // end test</pre>
<p><br/><br />
It&#8217;s easy to miss it, because there are edge cases, a truncation problem, and multiple termination conditions. I only discovered these cases when I worked through a very small sample set in my head. What worried me about the initial find is that I wasn&#8217;t shocked by the result of only 10% of developers getting this right. I think what&#8217;s concerning to me is that many people wouldn&#8217;t have tested it in isolation, just felt that they had a solution that worked, and moved on. But, then I can&#8217;t blame developers for this. I think this is the fault of working in an industry where being thorough isn&#8217;t as rewarded as it should be.</p>
<p>The more I work, the more I notice this problem. There is so much focus on short-term goals and results, that it&#8217;s easy to cut corners. &#8220;You need to finish feature X by COB today.&#8221; Well, in order to accomplish this, I notice most people will skip otherwise essential things such as unit testing, and sometimes not even test at all. The design phase is also often skipped, perhaps even more often than testing. When you&#8217;re given ambitious or impossible deadlines, it&#8217;s natural to skip designing and start coding right away. Worse is that if you do spend time designing and testing the software, you often aren&#8217;t rewarded for your efforts; Nobody notices.</p>
<p>Ultimately, what I&#8217;m noticing is that a lot of developers remove as much as 50% of the engineering effort, for 80% of the result. While maybe not the 80/20 principle, it&#8217;s close enough to feel like it. The problem is that I don&#8217;t believe software can follow the 80/20 principle and be effective. That loss of 20% is a lot of bugs&#8230; many relatively benign, but I also feel like that remaining 20% also encompasses most of the difficult to reproduce bugs; The bugs we are forced to write off and sometimes never successfully fix. At best, we pull out a roll of duct tape, use enough tape to keep it stable enough to hold together, hoping nobody notices.</p>
<p>As a developer, I can fully admit that when I&#8217;ve been pressed with unreasonable schedules, I&#8217;ve occasionally responded by cutting corners, just like most people would have handled it. This rarely resulted in a better product. It&#8217;s also almost impossible to later go back and rework the foundation when the tower is in danger of toppling over. In other industries, proceeding in this manner would be seen as ludicrous, but in software, it&#8217;s accepted. But, it&#8217;s unfair to blame developers for this; I blame short-sighted business models and managers who focus mostly on CYOA.</p>
<p>Anyway, coming full circle, I wouldn&#8217;t be surprised if there&#8217;s a search algorithm in your code base that doesn&#8217;t quite work for all cases. If you find a broken search in your code base, let me know and maybe I&#8217;ll even post your findings on this website.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarepurist.com/blog/index.php/binary-searches/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Front-End vs. Back-End Development</title>
		<link>http://www.softwarepurist.com/blog/index.php/front-end-vs-back-end-development/</link>
		<comments>http://www.softwarepurist.com/blog/index.php/front-end-vs-back-end-development/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 06:47:03 +0000</pubDate>
		<dc:creator>softwarepurist</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[automated testing]]></category>
		<category><![CDATA[back-end]]></category>
		<category><![CDATA[backend]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Load Testing]]></category>
		<category><![CDATA[Motif]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[sockets]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Unit Testing]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[XWindows]]></category>

		<guid isPermaLink="false">http://www.softwarepurist.com/blog/?p=232</guid>
		<description><![CDATA[I would say that one of the interesting things about my career, to date, is that I've probably had a pretty even split between front-end and back-end software. As such, I've noticed some interesting differences between the two, particularly with how they are approached.]]></description>
			<content:encoded><![CDATA[<p>Hi all. There was a bit of break because of the holidays, but now I&#8217;m back with a new post that I hope you will enjoy. In this edition, I wanted to discuss some of the differences between front-end and back-end software development. I would say that one of the interesting things about my career, to date, is that I&#8217;ve probably had a pretty even split between front-end and back-end software. As such, I&#8217;ve noticed some interesting differences between the two, particularly with how they are approached. When I speak of Front-End development, I&#8217;m really speaking more of visual-related code, particularly GUI code. As such, note that some of these observations don&#8217;t apply as heavily to related areas. When I speak of Back-End developmet, I&#8217;m generally speaking of the logic on a multi-user server application, such as a socket server, which handles requests from many users. With that, let&#8217;s get started.</p>
<p>So, the first thing to discuss here is ease of development. I&#8217;ll admit, outright, that this is a bit of an unfair category, because it will significantly vary depending on framework. For example, using some well-designed frameworks, setting up the GUI can involve a lot less programming. If you use one of these frameworks, a lot of the work can even be done by artists or designers, without much intervention by developers. Of course, if you&#8217;re doing more low-level GUI work, such as pure Win32 or XWindows/Motif, this doesn&#8217;t really apply to you. Having said that, for many applications, choosing a relatively high-level GUI framework is commonplace, unless there&#8217;s restrictions that prevent this from occurring, such as performance reasons or customer requirements. So, from the front-end side, you often wind up in a state, where the framework you&#8217;re using is already in place, and you&#8217;re making small extensions and the application basically derives from that. From a pure GUI standpoint, while designing the overall architecture is important useful, in some cases, especially in smaller applications, you can get away without it, or possibly define it later, through some refactoring techniques.</p>
<p>From the back-end side, the framework you&#8217;re using is often lower-level. Even if it&#8217;s higher-level, you still need to architect an application to integrate well for future needs and a lot of user requests, including making use of multiple cores and taking advantage of latency. Back-end work mixes both low-level and high-level concepts, and there is often a significant amount of work required to get something up and running. In many back-end applications, the logic on the back-end can be heavy, for the reason of security. At other levels, the data may not be trusted. On the back-end it is. Furthermore, back-end software typically operates with a database. The database has the interesting property of both making things simpler, in terms of coordinating many simulatenous requests, and also more complicated than typical front-end data storage. For example, on the front-end, it may be perfectly acceptable to store all data as XML and write all data to file immediately. This of course, would not scale to the back-end. Furthermore, the back-end has to worry about synchronization. Front-end applications can potentially get away with not making great use of idle processing time, but this is often not so on the back-end.</p>
<p>The front-end is a world where there is a lot more instant gratification. For example, you can design a new button, click a wizard option to add a handler, enable/disable the button at certain times and handle the button press, but initiating a file to be saved. You can code this and be testing, verify it and have new functionality to show the same day. This is usually not the case for back-end development. On the back-end you might be designing functionality such as saving some data to the database. So, you write the code to handle the request message from the client, you write the stored procedure you need (possibly to be tweaked by a DBA later), you code up the response to the message. After the same amount of time as spent on the GUI, are you done? Unfortunately, no. Firstly, having gone this far, the functionality isn&#8217;t actually verified; so it can potentially look like you haven&#8217;t done any work. This will continue until there is front-end code to interact with the back-end. However, sometimes the integration process can get messy, so it&#8217;s best to sprearhead problems before they can occur. Therefore, the next step is to write an automated test to restore the database to a known state, simulate the message occurring, verify the expected response and then verify the database has the correct data. You may require <em>n</em> of these types of tests, until you&#8217;re at a  point where you have confidence. From there, are you done? Alas, no. You still need to handle many users, so now it&#8217;s time to test many users performing the same thing. You would write an additional automated test, with a high number of users, repeatedly performing the same action: restore db to known state at beginning of test, simulate the message, verify the expected response, and verify correct data for that user&#8230; repeatedly for the number of users. Failure can happen at any time, so you might have cases where 8 out of 10,000 attempts fail, and you need to look at this and know why. Until your test passes, you&#8217;re not done. Then, until the front-end is making use of your code and integration has happened, nobody has seen it: which can be days, weeks, or longer. So, verification takes a very different route. This can be somewhat spearheaded by having the same developer work on both the front-end and the back-end for a particularly piece of functionality. There&#8217;s some merit to this approach, so I generally applaud this attempt.</p>
<p>Of course, this is not to say that there is no testing on the GUI. There often is, but for many companies, it&#8217;s about putting the work where there is the most value. Take the case where there&#8217;s 8 failures out of 10,000. This sort of scenario can happen on the GUI just as easily. The difference is that it may only occur when a particular user uses the software in a particular way. So, perhaps the issue is only noticed by 1 out of 1,000 users, because the other 999 don&#8217;t click as fast, or don&#8217;t click as repeatedly. As sad as it is to think about, being a software purist, these are the sorts of issues that are unlikely to get fixed, anyway. The type of testing that sometimes happens for GUI code is unit-tests when proper use of the Model-View Controller design pattern has occurred, and the model and control have been kept relatively framework-neutral. This can be difficult to achieve with some frameworks, so I don&#8217;t see unit testing happening on the GUI as much as it should. The second type of testing that often occurs on the GUI is using an automated framework that actually simulates a user clicking various buttons and runs through these scenarios. I see a lot of value in this, but often the software is very pricey. Most companies I&#8217;ve worked at have shyed away from this option because of the high cost involved.</p>
<p>So, anyway, hopefully this was an interesting discussion. This certainly isn&#8217;t the last discussion I will have about the differences and in future articles, I will talk about more steps to streamlining the process.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.softwarepurist.com/blog/index.php/front-end-vs-back-end-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

