<?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/"
	>

<channel>
	<title>reidblog &#187; Software</title>
	<atom:link href="http://nerdtron.ca/reid/category/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://nerdtron.ca/reid</link>
	<description>wherein Reid discusses things</description>
	<lastBuildDate>Sat, 04 Sep 2010 01:42:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>The Next Level of Mac</title>
		<link>http://nerdtron.ca/reid/2008/04/11/the-next-level-of-mac/</link>
		<comments>http://nerdtron.ca/reid/2008/04/11/the-next-level-of-mac/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 00:08:23 +0000</pubDate>
		<dc:creator>mr_reid</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://nerdtron.ca/reid/?p=29</guid>
		<description><![CDATA[I&#8217;ve been a half-assed user of Quicksilver since it came out. Several of my friends were really impressed and immediately started incorporating it into their workflows, but I never really picked up on it. Lately, that&#8217;s starting to change. I have a lot of stuff in my Applications folder. Even on my MacBook Pro&#8217;s 1920&#215;1200 [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a half-assed user of <a rel="tag" href="http://www.blacktree.com">Quicksilver</a> since it came out.  Several of my friends were really impressed and immediately started incorporating it into their workflows, but I never really picked up on it.  Lately, that&#8217;s starting to change.</p>
<p>I have a lot of stuff in my Applications folder.  Even on my MacBook Pro&#8217;s 1920&#215;1200 display, the dock would be severely cluttered if I actually had all of the stuff that I use fairly frequently on it.  Instead of having a cluttered dock, I started launching things through Spotlight.  This was a step in the right direction, because it saved me from going to the finder for Applications I used more rarely, and it&#8217;s easier than looking through a stack for the Applications folder.  The only problem is that the spotlight search feels slow, since I&#8217;m comparing it to the the run menu in <a rel="tag" href="http://www.gnome.org">GNOME</a> or <a rel="tag" href="http://www.enlightenment.org">Enlightenment</a>.  Quicksilver is <em>fast</em>.  I find myself removing things from the dock unless I run them every time I log in, because running them through quicksilver is inevitably faster.</p>
<p>I am also enjoying Quicksilver&#8217;s ability to figure out what text is.  Bringing up quicksilver, typing a url or an email address, and having a Safari or Mail.app window open is great.  Putting ideas into <a rel="tag" href="http://www.devon-technologies.com/products/devonthink/">DEVONthink</a>—which I am just starting to use—is also pretty straightforward once you toggle the &#8220;switch to text mode if no match is found&#8221; option.</p>
<p>There&#8217;s a lot of power behind Quicksilver.  Try it, and soon you&#8217;ll miss it wherever you don&#8217;t have it.</p>
]]></content:encoded>
			<wfw:commentRss>http://nerdtron.ca/reid/2008/04/11/the-next-level-of-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Self-Documenting My Ass</title>
		<link>http://nerdtron.ca/reid/2008/02/04/self-documenting-my-ass/</link>
		<comments>http://nerdtron.ca/reid/2008/02/04/self-documenting-my-ass/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 03:11:13 +0000</pubDate>
		<dc:creator>mr_reid</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Smart-Sounding Babble]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software engineering]]></category>
		<category><![CDATA[software quality]]></category>

		<guid isPermaLink="false">http://nerdtron.ca/reid/?p=26</guid>
		<description><![CDATA[As I mentioned previously, a lot of the projects I&#8217;ve been working on over the past year have been largely uncommented. This wasn&#8217;t viewed as an issue by the people working on these projects because the company had a heavy focus on using a &#8220;self-documenting&#8221; coding style. I&#8217;d like to take a moment to explain [...]]]></description>
			<content:encoded><![CDATA[<p>As I mentioned previously, a lot of the projects I&#8217;ve been working on over the past year have been largely uncommented.  This wasn&#8217;t viewed as an issue by the people working on these projects because the company had a heavy focus on using a &#8220;self-documenting&#8221; coding style.  I&#8217;d like to take a moment to explain in somewhat greater detail why this is, frankly, very stupid, especially on any non-trivial project that doesn&#8217;t have a permanent team.</p>
<p>I&#8217;d like to start with an english language example of self-documenting code.  It&#8217;s for building Lego.</p>
<p>Take an 8&#215;2 red brick.  Now take four red bricks which are 2&#215;2 on the bottom and 1&#215;2 at the top (slant pieces, as I called them when I was a kid).  Put them on top of the 8&#215;2 in two pairs with the thick parts together.  Take two red upside-down slant pieces (2&#215;2 on top and 1&#215;2 on the bottom) and put them on the bottom of the 8&#215;2 at the far ends with the thick parts facing inside.  Put a 6&#215;2 red brick between them.  Take another two red upside-down slant pieces and put them so the thick parts are on the outermost bumps of the 6&#215;2 with the slope facing outwards, and put a 4&#215;2 red brick between them.  Repeat this, but with a 2&#215;2 brick in the middle.  Finally, put two red upside-down slant pieces on the bottom, with the thick parts together.</p>
<p>If you followed these instructions properly, and if I wrote them properly, you&#8217;ve now made a red heart, because I love you.</p>
<p>So here&#8217;s the thing about self-documenting styles: they document what&#8217;s being done to solve a problem, but not the problem that&#8217;s being solved.  If the self-documenting code above had appeared after a comment that said &#8220;this makes a red heart,&#8221; everyone could have saved their time.</p>
<p>Here&#8217;s the fundamental point: code is a solution to a problem.  To <em>use</em> code, you need to know exactly what problem the code solves, so you can find a way to express your problem in the same terms.  If you have a digestive system (a solution to a problem) and a sandwich (data) and you&#8217;re hungry (a problem), you can solve the problem<sup>1</sup> by breaking the sandwich into pieces that are suitable for your digestive system (this is one problem that the mouth is a solution for).  But self-documenting code does <em>not</em> explicitly document the problem that it solves; it only documents how it solves it.  If it&#8217;s clear enough, you can figure out the problem from the solution, but it takes a while, sometimes longer than solving the problem took—as is probably the case in the lego example above.  If you&#8217;re given a disembodied digestive system and all you know about it is that it&#8217;s a bunch of funny tubes, you&#8217;re not going to be able to do much with it.  You might make sausage.</p>
<p>Even in cases where most of the problem can be immediately figured out, say a function called DisplayImage(), there&#8217;s still the issue of figuring out how the problem should be expressed.  Say you&#8217;re passing it the pixel data and the length and width: is the pixel data an array of rows of pixels, or is it just a lump of pixels that gets divided up given the length and width?  Is it one image where every value is RGBA, or is it four images, one for each channel?  With a self-documenting implementation, you still need to read the code and figure it out from how the data is used.  A Doxygen header here could answer would answer all of these questions concisely.</p>
<p>Now, self-documenting style is still vitally important, as anyone who has gone bug-hunting in a pile of <a rel="tag" href="http://en.wikipedia.org/wiki/Spaghetti_code">spaghetti code</a><sup>2</sup> with one letter variable names will tell you.  It makes bug-hunting infinitely less painful.  Everyone should always use it, but if your code is meant to be used as a library or elsewhere in the application, it should never, ever, ever constitute &#8220;documentation.&#8221;  It should become a black box with labels on it.  &#8220;Chips and pop go in, web sites come out.&#8221;  This part can only be done with documentation that is separate from the code.</p>
<ol style="font-size: 80%">
<li>You can also solve the related poo-generation problem.</li>
<li>The disembodied intestines are spaghetti code in several ways: they&#8217;re tangled, uncomfortable to debug and they solve the problem of what to do with spaghetti.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://nerdtron.ca/reid/2008/02/04/self-documenting-my-ass/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Risky Business</title>
		<link>http://nerdtron.ca/reid/2007/12/16/risky-business/</link>
		<comments>http://nerdtron.ca/reid/2007/12/16/risky-business/#comments</comments>
		<pubDate>Sun, 16 Dec 2007 23:45:49 +0000</pubDate>
		<dc:creator>mr_reid</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://nerdtron.ca/reid/?p=20</guid>
		<description><![CDATA[Over my last months doing contract programming I&#8217;ve seen a lot of code that has very little documentation or formal testing. The method of running successful projects has involved having competent programmers, consistent project management and good client communication. Most of these projects are for small companies who are new or just starting to take [...]]]></description>
			<content:encoded><![CDATA[<p>Over my last months doing contract programming I&#8217;ve seen a lot of code that has very little documentation or formal testing.  The method of running successful projects has involved having competent programmers, consistent project management and good client communication.  Most of these projects are for small companies who are new or just starting to take off, and I heard a lot of &#8220;I don&#8217;t think they&#8217;ll want pay for unit testing,&#8221; or &#8220;I don&#8217;t think they&#8217;ll pay for a 40-hour documentation run.&#8221;  This is true in most cases, and the logic behind it is backwards.</p>
<p>There are a lot of predictions that one can make based on the size of a company.  Smaller companies have a higher expected rate of return, since their smaller size increases the risk associated with any project.  Along with that higher expected rate of return is a sharper decline in the future value of money compared to the current value of money, and by extension a sharper decline in the value of future effort compared to effort now.  This kind of thinking makes smaller companies more inclined to not clear 40 man-hours to document a code base, knowing that in a year, when they expect to need to bring on another 10 programmers to handle the growing development load, it will cost well over 40 man-hours to bring them up to speed.  Additionally, that documentation would save time when designing new features by clarifying the ways the new features must interact with existing ones. The same goes with unit testing, which has an up-front cost but saves a lot of time once things are being added: not only does it provide yet more documentation of the expected behaviour, it provides free regression testing once the change requests start flowing in.  These are investments that keep on returning: they will save developer time for the entire length of the project.</p>
<p>Now, there&#8217;s a terrible thing that can happen in a software project, which I&#8217;ll call the &#8220;Oh, Shit&#8221; Moment (OSM).  This is the moment where one realises that one&#8217;s code base is incapable of supporting a change request or important new feature without considerable rework, or the moment the senior-most members of one&#8217;s team start spewing profanity and quit.  These moments happen often in the real world, especially with small companies where the scope of the software isn&#8217;t well defined.  For a small software company, an OSM can mean something as small as a few dozen unplanned programmer hours (ie, a few thousand dollars), or it could mean abandoning a significant amount of new code due to unexpectedly high integration cost, or it could mean a huge rewrite and possibly the end of the company.  So how do testing and documentation affect OSMs?</p>
<ul>
<li>No matter how readable one&#8217;s code is, design documentation is <i>always</i> more readable.  This helps new developers come up to speed quickly and saves existing developers time when they use code that has lain untouched for months or years.  This can both prevent and diminish the impact of an OSM.</li>
<li>When a bad design decision has been made, it tends to become much more obvious when one tries to explain it in plain language (and for some reason needs a thousand words); this can prevent some OSMs from ever happening.</li>
<li>A module which needs to be rewritten can avoid re-integration problems much more easily if there is a unit testing framework, or at least a well-documented interface that it must adhere to.  This will considerably reduce the impact of the OSM.</li>
<li>Unit tests created as bug-fixes from the original version are documented summaries of things to be careful of the next time around.</li>
<li>Documentation provides a clearer overall picture of the project, which will significantly aid decisions which must be made about the design and implementation of a module which must be rewritten.  This and the last point can turn an OSM today into a blessing in the future.</li>
<li>Documentation will help when it comes to estimating the development and integration cost of new features, which will help prioritize new features as well as see OSMs on the horizon.</li>
</ul>
<p>Smaller companies may not have more to gain from keeping good development practises than large companies, but they have a lot more to lose.  If a project at IBM fails, IBM shrugs, writes it off and continues being an enormous and generally profitable company.  If a project at a small company fails, it means a significant financial loss, if not the loss of their entire ability to generate new revenue.  We want to keep that rate of return high, and it&#8217;s worth that little extra investment up front.  Really.</p>
]]></content:encoded>
			<wfw:commentRss>http://nerdtron.ca/reid/2007/12/16/risky-business/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Patterns Are Not Good Programming</title>
		<link>http://nerdtron.ca/reid/2007/09/17/design-patterns-are-not-good-programming/</link>
		<comments>http://nerdtron.ca/reid/2007/09/17/design-patterns-are-not-good-programming/#comments</comments>
		<pubDate>Mon, 17 Sep 2007 07:21:05 +0000</pubDate>
		<dc:creator>mr_reid</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software engineering]]></category>
		<category><![CDATA[software quality]]></category>

		<guid isPermaLink="false">http://nerdtron.ca/reid/?p=11</guid>
		<description><![CDATA[This is something that&#8217;s been getting to me, lately.  The worst form of it is the almost religious devotion to model-view-controller (MVC), but in general, I think design patterns are an idea that people are largely taking the wrong way. By way of an explanation, consider a zen koan.  It&#8217;s relationship to zen is very, [...]]]></description>
			<content:encoded><![CDATA[<p>This is something that&#8217;s been getting to me, lately.  The worst form of it is the almost religious devotion to model-view-controller (MVC), but in general, I think design patterns are an idea that people are largely taking the wrong way.</p>
<p>By way of an explanation, consider a zen koan.  It&#8217;s relationship to zen is very, very much like the relationship of design patterns to good programming.  A koan is not zen.  It does not describe a zen state, but, if one looks at it properly, one can (un?)learn something about zen.  Memorizing a million koans will not bring one any closer to zen than memorizing one.  Doing as the characters in zen koans do does not bring one any closer to achieving zen.  Making a practice of kicking things over when you&#8217;re asked to describe them is probably not as appropriate as it was for Joshu&#8217;s cook.  There is something to be figured out in the koan, and once one understands it, the koan should be thrown away.  It is a linguistic container for the idea; the idea itself is necessarily more elegant and more compact.</p>
<p>Similarly, knowing lots of design patterns isn&#8217;t going to really make one a better programmer.  Using design patterns will probably result in better code, but it won&#8217;t, by itself, make one a better programmer.  Unlike zen, good programming can be described quickly and succinctly: getting the most good code with the least effort.</p>
<p>For example, the concept of MVC can be applied to a web service.  There&#8217;s a model for the data, a controller to do stuff with it, and a view that decodes method calls and encodes responses.  Let&#8217;s say that it&#8217;s an XML-RPC service: <em>all</em> the view does is convert back and forth between XML and locally usable data structures (assuming the controller validates its input properly).  Significantly, these structures are passed directly to controller, and what the controller returns is probably encoded and sent right out.  There is nothing significant happening here.  The view is extraneous.  In turbogears, for example, one could use the CherryPy to do the conversion; I believe the whole process is no longer than four lines.  Even in something as primitive as C or PHP, the view for the whole application, regardless of size, can be implemented in one function.  There&#8217;s no point in setting up a sacred View pedestal to put it on.</p>
<p>The lesson to take away from MVC is that by breaking a certain class of application into these three components, it becomes easier to modify any of the components without needing to change the others.  It prevents rewriting and saves effort, and less effort is better programming.  Once this lesson is learned, MVC as a strict thing can be thrown away, and the idea of compartmentalization that it provides can be applied in some form where appropriate.</p>
<p>The same applies to other patterns: they are ways of approaching specific classes of problems.  Although some of them are damn clever (think: visitor pattern), one will almost never run into a problem where the pattern, taken verbatim, is the best way to solve it.  What they are is programmer-koans that provide insight into the nature of the problem at hand, and the nature of good programming.  Design patterns are not good programming. </p>
]]></content:encoded>
			<wfw:commentRss>http://nerdtron.ca/reid/2007/09/17/design-patterns-are-not-good-programming/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
