<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Avoiding Special Cases</title>
	<atom:link href="http://uwmike.com/articles/2005/07/14/avoiding-special-cases/feed/" rel="self" type="application/rss+xml" />
	<link>http://uwmike.com/articles/2005/07/14/avoiding-special-cases/</link>
	<description>Hacker, Engineer, Dancer, Gentleman</description>
	<lastBuildDate>Mon, 06 Sep 2010 12:04:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ian</title>
		<link>http://uwmike.com/articles/2005/07/14/avoiding-special-cases/comment-page-1/#comment-3588</link>
		<dc:creator>Ian</dc:creator>
		<pubDate>Wed, 17 Aug 2005 22:18:28 +0000</pubDate>
		<guid isPermaLink="false">http://dev.uwmike.com/articles/2005/07/14/avoiding-special-cases#comment-3588</guid>
		<description>I &#039;discovered&#039; exactly this same thing a few weeks ago. It&#039;s a neat solution and I see no reason not to use it. If you are worried about not understanding your code in a few weeks, just make sure you write good comments.

Another trick useful for linked lists is to create dummy head and tail elements of exactly the same type as the real elements. This way you completely avoid any special cases when adding or removing items from the ends of the list because you are inserting *between* two existing elements (one of which is the dummy).</description>
		<content:encoded><![CDATA[<p>I &#8216;discovered&#8217; exactly this same thing a few weeks ago. It&#8217;s a neat solution and I see no reason not to use it. If you are worried about not understanding your code in a few weeks, just make sure you write good comments.</p>
<p>Another trick useful for linked lists is to create dummy head and tail elements of exactly the same type as the real elements. This way you completely avoid any special cases when adding or removing items from the ends of the list because you are inserting *between* two existing elements (one of which is the dummy).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Hildebrandt</title>
		<link>http://uwmike.com/articles/2005/07/14/avoiding-special-cases/comment-page-1/#comment-3567</link>
		<dc:creator>Ryan Hildebrandt</dc:creator>
		<pubDate>Fri, 22 Jul 2005 22:20:07 +0000</pubDate>
		<guid isPermaLink="false">http://dev.uwmike.com/articles/2005/07/14/avoiding-special-cases#comment-3567</guid>
		<description>Hey Mike, I&#039;m done the assignment, but after Monday, would you mind showing me the explaination for this code?  Looks like a great idea, if only I could get what you&#039;re trying to say here..</description>
		<content:encoded><![CDATA[<p>Hey Mike, I&#8217;m done the assignment, but after Monday, would you mind showing me the explaination for this code?  Looks like a great idea, if only I could get what you&#8217;re trying to say here..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Purvis</title>
		<link>http://uwmike.com/articles/2005/07/14/avoiding-special-cases/comment-page-1/#comment-3560</link>
		<dc:creator>Mike Purvis</dc:creator>
		<pubDate>Sun, 17 Jul 2005 20:14:15 +0000</pubDate>
		<guid isPermaLink="false">http://dev.uwmike.com/articles/2005/07/14/avoiding-special-cases#comment-3560</guid>
		<description>Yeah, well my previous pointer experience had been with Pascal, which is pretty touchy about those weirder things. PHP doesn&#039;t have pointers at all, in part, I expect, for stability, and simply because nested associative arrays are such a powerful structure.

This is supposed to be an introductory course for deer-in-the-headlight folks whose only prior experience is, you know, last year&#039;s C++ course.

Anyhow, yeah, once I drew a little diagram and got the stars and ampersands in the right places, it worked like a charm. But still, it would depend who else was seeing the code. Me in six months would probably still get it. But would co-worker X get it?

BTW, if you&#039;re even in Waterloo before September, Dan, you need to stop by for dinner so you can get USB mice working on my Gentoo...</description>
		<content:encoded><![CDATA[<p>Yeah, well my previous pointer experience had been with Pascal, which is pretty touchy about those weirder things. <acronym title="PHP: Hypertext Pre-processer">PHP</acronym> doesn&#8217;t have pointers at all, in part, I expect, for stability, and simply because nested associative arrays are such a powerful structure.</p>
<p>This is supposed to be an introductory course for deer-in-the-headlight folks whose only prior experience is, you know, last year&#8217;s C++ course.</p>
<p>Anyhow, yeah, once I drew a little diagram and got the stars and ampersands in the right places, it worked like a charm. But still, it would depend who else was seeing the code. Me in six months would probably still get it. But would co-worker X get it?</p>
<p><acronym title="By The Way">BTW</acronym>, if you&#8217;re even in Waterloo before September, Dan, you need to stop by for dinner so you can get <acronym title="Universal Serial Bus">USB</acronym> mice working on my Gentoo&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Dresser</title>
		<link>http://uwmike.com/articles/2005/07/14/avoiding-special-cases/comment-page-1/#comment-3559</link>
		<dc:creator>Daniel Dresser</dc:creator>
		<pubDate>Sun, 17 Jul 2005 19:18:06 +0000</pubDate>
		<guid isPermaLink="false">http://dev.uwmike.com/articles/2005/07/14/avoiding-special-cases#comment-3559</guid>
		<description>Well, personally, I can&#039;t really picture programming without pointer-pointers (and crazier things once the data structures get more interesting).

I guess you engineers are probably working in C as opposed to C++?  In C++, if you aren&#039;t worried at all about performance, you can write some very tight binary tree code using classes and recursive calls (I seem to recall one that actually stored extra leaf nodes that contain no data, but simplified the cases, allowing very short methods.)

The only reason to be using C these days is if you&#039;re really performance paranoid, in which case you ought to be pretty comfortable with strange pointer operations.

</description>
		<content:encoded><![CDATA[<p>Well, personally, I can&#8217;t really picture programming without pointer-pointers (and crazier things once the data structures get more interesting).</p>
<p>I guess you engineers are probably working in C as opposed to C++?  In C++, if you aren&#8217;t worried at all about performance, you can write some very tight binary tree code using classes and recursive calls (I seem to recall one that actually stored extra leaf nodes that contain no data, but simplified the cases, allowing very short methods.)</p>
<p>The only reason to be using C these days is if you&#8217;re really performance paranoid, in which case you ought to be pretty comfortable with strange pointer operations.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Purvis</title>
		<link>http://uwmike.com/articles/2005/07/14/avoiding-special-cases/comment-page-1/#comment-3558</link>
		<dc:creator>Mike Purvis</dc:creator>
		<pubDate>Fri, 15 Jul 2005 17:50:38 +0000</pubDate>
		<guid isPermaLink="false">http://dev.uwmike.com/articles/2005/07/14/avoiding-special-cases#comment-3558</guid>
		<description>Basically, I guess it ends up being a discussion about abstraction. The more &#039;levels&#039; something can be abstracted in, the more &#039;[bottom-uppy](http://www.paulgraham.com/progbot.html)&#039; the code is, and hence more reusable.</description>
		<content:encoded><![CDATA[<p>Basically, I guess it ends up being a discussion about abstraction. The more &#8216;levels&#8217; something can be abstracted in, the more &#8216;[bottom-uppy](http://www.paulgraham.com/progbot.html)&#8217; the code is, and hence more reusable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeffrey Aho</title>
		<link>http://uwmike.com/articles/2005/07/14/avoiding-special-cases/comment-page-1/#comment-3555</link>
		<dc:creator>Jeffrey Aho</dc:creator>
		<pubDate>Fri, 15 Jul 2005 04:54:46 +0000</pubDate>
		<guid isPermaLink="false">http://dev.uwmike.com/articles/2005/07/14/avoiding-special-cases#comment-3555</guid>
		<description>I&#039;d go with your creative solution. They mark it on output and as long as you make comments and it is the right solution, they will give you the marks. I would greatly like to see the code (after mine is done, of course) and get an explaination. I&#039;m going to stick to the cases, as it&#039;s what I know. Safe.</description>
		<content:encoded><![CDATA[<p>I&#8217;d go with your creative solution. They mark it on output and as long as you make comments and it is the right solution, they will give you the marks. I would greatly like to see the code (after mine is done, of course) and get an explaination. I&#8217;m going to stick to the cases, as it&#8217;s what I know. Safe.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- uwMike.com will return...-->
