<?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>ThotSpots &#187; complexity</title>
	<atom:link href="http://www.thotspots.com/tag/complexity/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thotspots.com</link>
	<description>Agile Software Development</description>
	<lastBuildDate>Wed, 09 Sep 2009 18:13:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>&#8220;Clean Code&#8221; &#8212; Crafting On Principles</title>
		<link>http://www.thotspots.com/clean-code-book/</link>
		<comments>http://www.thotspots.com/clean-code-book/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 21:26:00 +0000</pubDate>
		<dc:creator>Craig Jones</dc:creator>
				<category><![CDATA[Agile Development]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[clean code]]></category>
		<category><![CDATA[complexity]]></category>
		<category><![CDATA[design principles]]></category>
		<category><![CDATA[naming conventions]]></category>
		<category><![CDATA[Robert Martin]]></category>
		<category><![CDATA[simplicity]]></category>

		<guid isPermaLink="false">http://www.thotspots.com/?p=109</guid>
		<description><![CDATA[I&#8217;ve been reading &#8220;Clean Code: A Handbook of Agile Software Craftsmanship&#8221; by Robert Martin.  This is no ordinary book on writing better software.  It&#8217;s not just a rehash of &#8220;Code Complete&#8221; or &#8220;The Pragmatic Programmer.&#8221;  Those are both fine books, but &#8220;Clean Code&#8221; is different.  So, please don&#8217;t think that if [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been reading &#8220;<a href="http://www.amazon.com/gp/product/0132350882?ie=UTF8&#038;tag=thotspots-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=0132350882">Clean Code: A Handbook of Agile Software Craftsmanship</a><img src="http://www.assoc-amazon.com/e/ir?t=thotspots-20&#038;l=as2&#038;o=1&#038;a=0132350882" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />&#8221; by Robert Martin.  This is no ordinary book on writing better software.  It&#8217;s not just a rehash of &#8220;Code Complete&#8221; or &#8220;The Pragmatic Programmer.&#8221;  Those are both fine books, but &#8220;Clean Code&#8221; is different.  So, please don&#8217;t think that if you&#8217;ve read one, you&#8217;ve read them all.</p>
<p>In Clean Code, Martin doesn&#8217;t just name the best practices we should all be following.  He explains the reasoning behind each one and gives names to the concepts.  Just as the idea of software design patterns revolutionized the way we think and talk about software architecture, Martin&#8217;s exploration of day-to-day coding habits gives us a smarter way to think and talk about that.</p>
<p>Case in point: Clean Code kicks off with the practice of giving your objects meaningful names.  One aspect of this is that good names do not require anyone who might read your code in the future to have to perform any &#8220;mental mappings.&#8221;  Here&#8217;s an example of this that I came across just the other day.<span id="more-109"></span></p>
<pre>var ld = new LoginData();</pre>
<p>Look carefully, that&#8217;s a lower-case <span style="font-family: courier new,courier,monospaced">L</span>.  At first glance, it looks like a capital <span style="font-family: courier new,courier,monospaced">I</span>, as in &#8220;ID,&#8221; as in &#8220;identifier.&#8221;  I don&#8217;t know how long I spent confused about how a class constructor could be returning an identifier when reading through this code for first time.  Maybe ten or fifteen seconds?  Time in which I was completely distracted from understanding the rest of the code, having pushed that problem onto the stack, as it were, in order to first solve this mini-problem.</p>
<p>Even without the <span style="font-family: courier new,courier,monospaced">I</span> vs. <span style="font-family: courier new,courier,monospaced">L</span> confusion, using an abbreviated variable name meant that whenever I came across it, I had to keep reminding myself that it stood for an instance of LoginData.  That may not seem like a big deal, but we humans only have so much stack space before we run out of short-term memory.  When a program is full of one- and two-letter variable names that must be continually translated mentally, it leaves no room for thinking about the actual problem that the program is trying to solve.</p>
<p>All of this could have been avoided if the name was spelled out to begin with, so I changed it (using the automated rename refactoring tool in my IDE):</p>
<pre>var loginData = new LoginData();</pre>
<p>&#8220;One difference between a smart programmer and a professional programmer is that the professional programmer understands that clarity is king.  Professionals use their powers for good and write code that others can understand.&#8221; ~ Robert (Uncle Bob) Martin</p>
<p>Martin could have just said, &#8220;don&#8217;t use abbreviations in variables names, because you&#8217;ll make the reader translate it in his head every time he reads it,&#8221; and that would have been terrific advice alone.  But what he really gives you is a deep understanding of the key principles involved, so that you won&#8217;t need to memorize a bunch of arbitrary coding standards in order to write cleaner code.  Instead, you&#8217;ll be armed with a few simple, understandable principles to guide you, with clean code being the natural outcome.</p>
<p>Clean Code is a must-read for everyone in the software profession &#8212; from college freshmen on up to CTOs &#8212; especially anyone who finds himself out of work in this economy (or worried about the possibility).  Learning to write clean code, and thus to write more valuable code, is probably the single most effective thing you can do for yourself. Programmers are expensive resources.  The work we produce is costly.  It&#8217;s up to us to treat it with the respect it deserves, to try and make it as valuable as possible, and to maintain that value as long as possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thotspots.com/clean-code-book/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Magic Number Seven WRT the Framework Simplicity Conundrum</title>
		<link>http://www.thotspots.com/the-magic-number-seven-wrt-the-framework-simplicity-conundrum/</link>
		<comments>http://www.thotspots.com/the-magic-number-seven-wrt-the-framework-simplicity-conundrum/#comments</comments>
		<pubDate>Sun, 11 Feb 2007 05:48:07 +0000</pubDate>
		<dc:creator>Craig Jones</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[complexity]]></category>
		<category><![CDATA[design principles]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[simplicity]]></category>

		<guid isPermaLink="false">http://www.thotspots.com/?p=22</guid>
		<description><![CDATA[Mid last year, Kurt Williams wrote "Beware of Simplicity" [<a HREF="http://jroller.com/page/cardsharp?entry=beware_simple_frameworks">jroller.com/page/cardsharp?entry=beware_simple_frameworks</a>] in development frameworks.  According to him, new and fresh frameworks can only claim to be simple because they are immature.  All frameworks are doomed to growing more complex as they grow in features.  I can't argue with that.  It seems to me, therefore, that the best frameworks are the ones that do the best job of hiding that complexity -- either because of the innate architecture of the framework, or by virtue of the tools and practices that deal with the complexity for you.  A framework can have all of the under-the-hood complexity it needs.  It's the day-to-day, in-your-face complexity that I care about.

In the field of cognitive psychology there's this so-called "Magic Number 7."  Basically, the idea is that humans can only keep 7 disjointed "things", plus or minus two, in short-term memory at once.  To see what I mean, study the following list of words for a minute.  Then, turn away and write down as many as you can from memory:]]></description>
			<content:encoded><![CDATA[<p>Mid last year, Kurt Williams wrote &#8220;<a href="http://jroller.com/page/cardsharp?entry=beware_simple_frameworks">Beware of Simplicity</a>&#8221; in development frameworks.  According to him, new and fresh frameworks can only claim to be simple because they are immature.  All frameworks are doomed to growing more complex as they grow in features.  I can&#8217;t argue with that.  It seems to me, therefore, that the best frameworks are the ones that do the best job of hiding that complexity &#8212; either because of the innate architecture of the framework, or by virtue of the tools and practices that deal with the complexity for you.  A framework can have all of the under-the-hood complexity it needs.  It&#8217;s the day-to-day, in-your-face complexity that I care about.</p>
<p>In the field of cognitive psychology there&#8217;s this so-called &#8220;Magic Number 7.&#8221;  Basically, the idea is that humans can only keep 7 disjointed &#8220;things&#8221;, plus or minus two, in short-term memory at once.  To see what I mean, study the following list of words for a minute.  Then, turn away and write down as many as you can from memory:<br />
<span id="more-22"></span><br />
Apricot, ladder, storm, headphones, spark-plug, sneaker, anchor, coin, library, twenty-seven, lyrics, nail, telescope, onion.</p>
<p>How&#8217;d you do?  I could only recall nine of them (even though I was the one who made up the darn list just now), and in fact, I had to work hard to recall the eighth and ninth.  By the way, IQ has nothing to do with this number.  Whether you&#8217;re closer to Mensa or Densa, your short-term recall factor will still be 7 +/- 2.  (See <a href="http://en.wikipedia.org/wiki/The_Magical_Number_Seven%2C_Plus_or_Minus_Two">Wikipedia</a> and George Miller&#8217;s 1956 paper that first noted the phenomenon is at <a href="http://www.musanim.com/miller1956/">www.musanim.com/miller1956/</a>.)</p>
<p>As the Wikipedia article points out, Ed Yourdon first commented on how this relates to computer science back in 1979.  He described what we would today refer to as the long-method smell (see <a href="http://www.soberit.hut.fi/mmantyla/BadCodeSmellsTaxonomy.htm">www.soberit.hut.fi/mmantyla/BadCodeSmellsTaxonomy.htm</a>), citing the magic number 7 as why it&#8217;s bad to tax the short-term memory of someone trying to understand a piece of code.</p>
<p>So, how often does your web framework require you to keep track of more than seven things at once?  Take, for example, the simple task of creating a data-entry page.  How many different files need to be created or modified to accomplish this? One for the HTML template, one for the page logic, multiple files for each model object (interface, impl, and ORM mapping), the DAO (interface and impl), the config file with the URL construction rules, the config file with the user security rules, the config file that lists all of the pages on the site, the interface file with constants for all those page names?  &#8212; That&#8217;s eleven and counting.  Sound familiar?  This amount of complexity often leads to things falling through the cracks, and is usually reflected in a high number of bug reports.</p>
<p>From what I have seen, Ruby on Rails has made this particular task as simple as it can be, and that accounts for a great deal of RoR&#8217;s appeal, I&#8217;m sure.  Even .Net has this down cold.  In the case of RoR, it&#8217;s an innate feature of the framework.  In the case of .Net, it&#8217;s simplified by the tools.  I&#8217;m still waiting for a Java-based framework/environment that &#8220;gets it&#8221; in this regard.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thotspots.com/the-magic-number-seven-wrt-the-framework-simplicity-conundrum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
