<?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:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>FuglyCode</title>
	<atom:link href="http://www.fuglycode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fuglycode.com</link>
	<description>\fʌ-gli koʊd\ n: How not to code!</description>
	<lastBuildDate>Tue, 06 Apr 2010 04:14:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Multiple Nested If Statements</title>
		<link>http://www.fuglycode.com/2010/04/05/multiple-nested-if-statements/</link>
		<comments>http://www.fuglycode.com/2010/04/05/multiple-nested-if-statements/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 17:00:55 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Fugly Code]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[fugly]]></category>
		<category><![CDATA[if]]></category>
		<category><![CDATA[nested]]></category>

		<guid isPermaLink="false">http://www.fuglycode.com/?p=298</guid>
		<description><![CDATA[This week&#8217;s fugly code comes from my past experiences as a C developer, and is actually one of the first pieces of advice my Team Lead gave me when I joined his group.
You see, I was working on this function that returned a value based on a few incoming parameters, and the lead admitted he [...]]]></description>
			<content:encoded><![CDATA[<p>This week&#8217;s fugly code comes from my past experiences as a C developer, and is actually one of the first pieces of advice my Team Lead gave me when I joined his group.</p>
<p>You see, I was working on this function that returned a value based on a few incoming parameters, and the lead admitted he was having difficulty reading the code.  It looked something like the following snippet:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p298code4'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2984"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
</pre></td><td class="code" id="p298code4"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> myFunction<span style="color: #009900;">&#40;</span> <span style="color: #993333;">int</span> a<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> b<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> c <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #808080; font-style: italic;">/* Initialize return value */</span>
  <span style="color: #993333;">int</span> returnValue <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/* Determine return value */</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> a <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">||</span> b <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">||</span> c <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/* Provided values are invalid, return -1 */</span>
    returnValue <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> a <span style="color: #339933;">&gt;</span> b <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      returnValue <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> b <span style="color: #339933;">&gt;</span> c <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      returnValue <span style="color: #339933;">=</span> <span style="color: #0000dd;">2</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> c <span style="color: #339933;">&gt;</span> a <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      returnValue <span style="color: #339933;">=</span> <span style="color: #0000dd;">3</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span>
    <span style="color: #009900;">&#123;</span>
      returnValue <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Do more stuff here</span>
&nbsp;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/* Return the value */</span>
  <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span> returnValue <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>Lets take a minute to review this function&#8230;</strong></p>
<ul>
<li>At line 1, we begin our function and accept 3 integers</li>
<li>At line 4, we create a variable to hold the value our function will return upon completion</li>
<li>At line 7, we enter an if statement and check to see if any of the provided values are 0</li>
<li>If any of the values are 0, then we set our return value to -1</li>
<li>Otherwise, we enter our else block and determine our return value</li>
<li>At line 31, we have code that does other important stuff</li>
<li>Finally, at line 36, we return our return value</li>
</ul>
<p>&nbsp;</p>
<p><em>Note: the &#8220;other stuff&#8221; code at line 31 was not reproduced as we don&#8217;t really care what it does in this example, but we do need to know that it is there.</em></p>
<p>My Lead&#8217;s beef with the function above mostly had to do with lines 7 through 33.  Specifically, he deplored the fact that the if statement was the length of the function, and also questioned the reasoning behind letting the function continue its flow if the parameters were determined to be incorrect. (For example, if we add code to line 34, it will be run regardless of the parameters being valid or not.)</p>
<p>He explained that, although nested if statements could be useful from time to time, they should generally be avoided as they make code difficult to maintain.</p>
<p>So I asked him how I could avoid nested if statements, and he proposed that I simply return the -1 value at line 10, instead of assigning it to a variable and returning it later on.  This would simplify the function, and would remove the function-long if statement:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p298code5'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2985"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code" id="p298code5"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> myFunction<span style="color: #009900;">&#40;</span> <span style="color: #993333;">int</span> a<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> b<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> c <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #808080; font-style: italic;">/* Initialize return value */</span>
  <span style="color: #993333;">int</span> returnValue <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/* Validate Parameters */</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> a <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">||</span> b <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">||</span> c <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/* Provided values are invalid, return -1 */</span>
    <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/* Determine return value */</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> a <span style="color: #339933;">&gt;</span> b <span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    returnValue <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> b <span style="color: #339933;">&gt;</span> c <span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    returnValue <span style="color: #339933;">=</span> <span style="color: #0000dd;">2</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> c <span style="color: #339933;">&gt;</span> a <span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    returnValue <span style="color: #339933;">=</span> <span style="color: #0000dd;">3</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span>
  <span style="color: #009900;">&#123;</span>
    returnValue <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Do more stuff here</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/* Return the value */</span>
  <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span> returnValue <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And there we go.  By immediately returning the value -1, we can remove the else block and avoid putting the whole function in an if statement.  </p>
<p>This might not seem like much right now, but one day you might run into a very large function with multiple lines of code and multiple if statements that persist throughout the function.  And on that day you&#8217;ll hit your forehead with your hand and wonder why the function&#8217;s author didn&#8217;t read FuglyCode.com <img src='http://www.fuglycode.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  </p>
<p><strong>Function Optimization</strong></p>
<p>This function could be even more optimized.  Can you figure out how?</p>
<p>Try rewriting this function to make it as optimal as possible and then compare what you wrote with my code (click on the down arrow to expand the code box).  Feel free to share your code in the comments if its any different from mine!</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p298code6'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2986"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td class="code" id="p298code6"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> myFunction<span style="color: #009900;">&#40;</span> <span style="color: #993333;">int</span> a<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> b<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> c <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #808080; font-style: italic;">/* Validate Parameters */</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> a <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">||</span> b <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">||</span> c <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/* Provided values are invalid, return -1 */</span>
    <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/* Call new doMoreStuff function */</span>
  doMoreStuff<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/* Return a value */</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> a <span style="color: #339933;">&gt;</span> b <span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span> <span style="color: #0000dd;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> b <span style="color: #339933;">&gt;</span> c <span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span> <span style="color: #0000dd;">2</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> c <span style="color: #339933;">&gt;</span> a <span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span> <span style="color: #0000dd;">3</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span> <span style="color: #0000dd;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> doMoreStuff <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #808080; font-style: italic;">/* Move the do more stuff into its own function *
   * to increase reusability and readability */</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.fuglycode.com/2010/04/05/multiple-nested-if-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<series:name><![CDATA[FuglyCode of the Week]]></series:name>
	</item>
		<item>
		<title>Welcome!</title>
		<link>http://www.fuglycode.com/2010/03/30/welcome/</link>
		<comments>http://www.fuglycode.com/2010/03/30/welcome/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 05:20:41 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Announcements]]></category>

		<guid isPermaLink="false">http://www.fuglycode.com/?p=279</guid>
		<description><![CDATA[Welcome to FuglyCode.com, where we study the art of software development and proper code.  We currently have two article series on the go, which you can find below:
FuglyCode of the Week
 Every Monday at 12pm eastern
Every week, take a look at software code as we study the dos and dont&#8217;s of software development.
Latest Article: Multiple [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to FuglyCode.com, where we study the art of software development and proper code.  We currently have two article series on the go, which you can find below:</p>
<div id="attachment_177" class="wp-caption alignleft" style="width: 183px"><a href="http://www.fuglycode.com/series/fuglycode-of-the-week/"><img class="size-full wp-image-177  " title="Its So Fugly..." src="http://www.fuglycode.com/wp-content/uploads/2010/03/sofugly1.jpg" alt="Its So Fugly..." width="173" height="130" /></a><p class="wp-caption-text">It's So Fugly...</p></div>
<p><a href="http://www.fuglycode.com/series/fuglycode-of-the-week/" target="_self"><strong>FuglyCode of the Week</strong></a><br />
<em> Every Monday at 12pm eastern</em></p>
<p>Every week, take a look at software code as we study the dos and dont&#8217;s of software development.</p>
<p>Latest Article: <a title="Permalink to Error Handling vs Method Overloading" href="http://www.fuglycode.com/2010/04/05/multiple-nested-if-statements/">Multiple Nested If Statements</a></p>
<p>&nbsp;</p>
<div id="attachment_256" class="wp-caption alignleft" style="width: 183px"><a href="http://www.fuglycode.com/series/blog-tools-review/"><img class="size-full wp-image-256   " title="Blog Tools" src="http://www.fuglycode.com/wp-content/uploads/2010/03/tools-e1269799474397.jpg" alt="Blog Tools" width="173" height="128" /></a><p class="wp-caption-text">Blog Tools</p></div>
<p><a href="http://www.fuglycode.com/series/blog-tools-review/" target="_self"><strong>Blog Tools Reviews</strong></a><br />
<em> Every Wednesday at 12pm eastern</em></p>
<p>Interested in building an online blog?  Join FuglyCode as we review useful blog plugins that you can use on your WordPress blog.</p>
<p>Latest Article:  <a href="http://www.fuglycode.com/2010/03/10/blog-widgets-flexo-archives/" target="_self">Blog Widgets, Flexo Archives</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuglycode.com/2010/03/30/welcome/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A Quick Update</title>
		<link>http://www.fuglycode.com/2010/03/30/a-quick-update/</link>
		<comments>http://www.fuglycode.com/2010/03/30/a-quick-update/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 05:17:35 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Announcements]]></category>

		<guid isPermaLink="false">http://www.fuglycode.com/?p=287</guid>
		<description><![CDATA[Hey everybody, I just felt like posting  a quick update.
So first, you&#8217;ll notice a new Welcome post on the site&#8217;s front page.  The goal of this new post is to help visitors quickly access the site&#8217;s latest content.  I expect to replace the post with a full time web page, but until that page is built, [...]]]></description>
			<content:encoded><![CDATA[<p>Hey everybody, I just felt like posting  a quick update.</p>
<p>So first, you&#8217;ll notice a new <a href="http://www.fuglycode.com/2010/03/28/welcome/" target="_self">Welcome</a> post on the site&#8217;s front page.  The goal of this new post is to help visitors quickly access the site&#8217;s latest content.  I expect to replace the post with a full time web page, but until that page is built, keep an eye on the post for any updates.</p>
<p>Also, you may have noticed no articles have been posted for a couple of days now.  Well, I&#8217;ve been having some issues with new posts that are waiting to be published.  I hope to resolve these issues soon and begin posting new articles next week.  In the meantime, keep an eye on the site in the event something I resolve the issue this week.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuglycode.com/2010/03/30/a-quick-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error Handling vs Method Overloading</title>
		<link>http://www.fuglycode.com/2010/03/22/error-handling-vs-method-overloading/</link>
		<comments>http://www.fuglycode.com/2010/03/22/error-handling-vs-method-overloading/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 17:00:54 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Fugly Code]]></category>
		<category><![CDATA[exceptions]]></category>
		<category><![CDATA[fugly]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.fuglycode.com/?p=152</guid>
		<description><![CDATA[Error handling in programming languages allows software developers to build safeguards into their code to protect against possible exceptions or errors during runtime.  Method overloading, on the other hand, allows developers to build multiple methods of the same name, but that act differently depending on their method signatures (ie: different parameters).
Lets take the following [...]]]></description>
			<content:encoded><![CDATA[<p>Error handling in programming languages allows software developers to build safeguards into their code to protect against possible exceptions or errors during runtime.  Method overloading, on the other hand, allows developers to build multiple methods of the same name, but that act differently depending on their method signatures (ie: different parameters).</p>
<p>Lets take the following snipped of FuglyCode for example:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p152code9'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1529"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code" id="p152code9"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> Tester<span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aobject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Object</span></a> myObject <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> myString<span style="color: #339933;">;</span>
  <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainteger+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Integer</span></a> myInt<span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">try</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Save the string</span>
    myString <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> <span style="color: #009900;">&#41;</span> myObject<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Do more String stuff...</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> e <span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// The object was not a string</span>
    <span style="color: #666666; font-style: italic;">// Save the integer</span>
    myInt <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainteger+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Integer</span></a> <span style="color: #009900;">&#41;</span> myObject<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Do more Integer stuff...</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">return</span><span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p style="text-align: center;"><em>Special thanks to <strong>jpuly</strong> for submitting this code.  <a href="http://www.fuglycode.com/contact-us/" target="_self">Submit your fugly code here</a>.</em></p>
<p>Before we begin analyzing the fuglyness of this code, lets go over it to make sure we all understand what seems to be going on:</p>
<ul>
<li>At line 1, we enter our Tester method and receive an object</li>
<li>At line 7, we attempt to save our object to a String variable</li>
<li>At line 11, we catch any exception of type <em>Exception</em> (pretty much, we catch any exception)</li>
<li>At line 15, we assume that the exception was caused by saving the object to a string, so we save our object to an Integer variable</li>
</ul>
<p></p>
<p>One of the biggest problems with this code is that, although we accept any Exception type, we assume that the only reason our code would throw an exception would be because of the String cast on line 7.  What if the myObject parameter is a String, and code does something on line 9 that throws an exception?</p>
<p>Obviously the exception will be caught and the catch block will be run.  Because myObject is a string, however, the Integer cast on line 15 will throw an exception, and since we don&#8217;t have any code to handle and exception thrown at that line, our program will crash and burn.</p>
<p>So what could you do?  Well, you could begin by using a much more specific Exception type.  In fact, changing line 11 to &#8220;catch ( ClassCastException e )&#8221; would ensure that we only enter the catch block if the String cast on line 7 failed, although it wouldn&#8217;t protect against other exceptions being thrown, or against myObject being something other than a String or an Integer.</p>
<div id="attachment_225" class="wp-caption alignright" style="width: 201px"><a href="http://www.fuglycode.com/wp-content/uploads/2010/03/kiss.jpg"><img class="size-full wp-image-225" title="Keep It Simple, Stupid!" src="http://www.fuglycode.com/wp-content/uploads/2010/03/kiss.jpg" alt="Keep It Simple, Stupid!" width="191" height="88" /></a><p class="wp-caption-text">KISS!</p></div>
<p>In this particular situation, we need to take a step back and look at the method as a whole.  What are we trying to accomplish here?  Does the code have to be so complicated? (Remember KISS!)</p>
<p>Truth is, our Tester method is using error handling to make a decision (if myObject is a String, do something, otherwise, do something else).  Not only is this poor software design, but it fails to capitalize on the programming language&#8217;s built in ability to overload methods.</p>
<p>So, lets scrap the error handling altogether, and split this method into two similar methods with differing signatures:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p152code10'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p15210"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p152code10"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> Tester<span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> myString <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Do String stuff... (optionally wrap in try/catch block)</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">return</span><span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> Tester<span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainteger+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Integer</span></a> myInt <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Do Integer stuff... (optionally wrap in try/catch block)</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">return</span><span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And there we go!  Now we have two methods with the same names (meaning our calling code doesn&#8217;t have to change).  We also specify our parameter types, meaning that the compiler will not allow us to call Tester with anything other than either an Integer or a String.  And as a final and optional touch, we can add error handling at lines 2 and 7, in case these lines risk throwing an exception.</p>
<p>If you have any questions, feel free to post them in the comments section below.</p>
<p>If you would like to ask your question privately, you can send it using the <a href="http://www.fuglycode.com/contact-us/">Contact Us form</a>.</p>
<p>Do you have any FuglyCode you would like to share?  If so, then <a href="http://www.fuglycode.com/contact-us/">submit it</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuglycode.com/2010/03/22/error-handling-vs-method-overloading/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<series:name><![CDATA[FuglyCode of the Week]]></series:name>
	</item>
		<item>
		<title>Blog Widgets, Flexo Archives</title>
		<link>http://www.fuglycode.com/2010/03/10/blog-widgets-flexo-archives/</link>
		<comments>http://www.fuglycode.com/2010/03/10/blog-widgets-flexo-archives/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 17:00:30 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://www.fuglycode.com/?p=142</guid>
		<description><![CDATA[Today we&#8217;ll be reviewing a fun little plugin called Flexo Archives, but before we do, lets talk a little bit about Widgets.
What&#8217;s a widget?
A WordPress Widget is a plugin (or part of a plugin) that is designed to provide a simple way to arrange the various elements of your blog&#8217;s sidebar content without having to [...]]]></description>
			<content:encoded><![CDATA[<p>Today we&#8217;ll be reviewing a fun little plugin called Flexo Archives, but before we do, lets talk a little bit about Widgets.</p>
<p><strong>What&#8217;s a widget?</strong></p>
<blockquote><p>A WordPress Widget is a plugin (or part of a plugin) that is designed to provide a simple way to arrange the various elements of your blog&#8217;s sidebar content without having to change any code.</p>
<p>- <em>Paraphrase from </em><a href="http://codex.wordpress.org/WordPress_Widgets" target="_blank"><em>WordPress.org&#8217;s Widget Page</em></a></p></blockquote>
<p>So in other words, a widget can be seen as the physical manifestation of a plugin on your site.</p>
<p>If you take a look at the side of the screen you&#8217;ll see FuglyCode&#8217;s sidebar, and within that sidebar you&#8217;ll see a login form (that is, unless you&#8217;re logged in, of course), which is one of a handful of widgets displayed on the site.</p>
<p>Some plugins will come with one or many widgets, that you can freely add to your sidebar as you see fit, whereas others do not require a widget to work (<a href="http://www.fuglycode.com/2010/03/03/blog-tools-review-akismet/" target="_self">Akismet</a>, for example, does not need to be displayed on the sidebar for it to filter comment spam).</p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<div id="attachment_155" class="wp-caption alignleft" style="width: 152px"><a href="http://www.fuglycode.com/wp-content/uploads/2010/03/flexo_archives_off.png"><img class="size-full wp-image-155" title="Large Archives" src="http://www.fuglycode.com/wp-content/uploads/2010/03/flexo_archives_off.png" alt="Large Archives" width="142" height="648" /></a><p class="wp-caption-text">Large Archives</p></div>
<p><strong>The Popular Archives Widget</strong></p>
<p>One of the most popular widgets I&#8217;ve seen on blogs is the Archives widget (which should be somewhere on FuglyCode&#8217;s sidebar as well).  The widget lists each month your blog has been in operation, along with the number of posts for that month.  When the visitor clicks on the month, they are presented with a short description of each post and can read further by clicking on those posts.</p>
<p>This widget is very useful, as it allows visitors to jump to past posts that would otherwise be buried deep within your blog with just one click.  An issue arises, however, when your blog begins to age.  My personal site, for example, has been online for over two years, and the default Archives Widget (seen to the left) has gotten quite long.</p>
<p><strong>Flexo Archives to the Rescue!</strong></p>
<p>Large archives can become a nuisance to visitors, and take up a lot of valuable site retail space on your blog.  Luckily, today&#8217;s plugin offers a quick and easy solution to the problem.</p>
<p>Developed by <a href="http://wordpress.org/extend/plugins/profile/heathharrelson" target="_blank">heathharrelson</a>, Flexo Archives comes with its own widget that you can use instead of the default Archives widget provided by WordPress.  The widget regroups the months of your archive into collapsible years, which visitors can then click on to expand.</p>
<p>Its very easy to install (honestly, it only takes 2 to 3 clicks of the mouse), although it only works if visitors have JavaScript enabled (without javascript, all months display just like the default archive plugin).  Some users have also reported that their archive list will sometimes not match the look of their blog.  This is more often than not caused by the blog&#8217;s stylesheets not having any defined styles for lists.</p>
<div id="attachment_156" class="wp-caption alignright" style="width: 155px"><a href="http://www.fuglycode.com/wp-content/uploads/2010/03/flexo_archives_on.png"><img class="size-full wp-image-156" title="Flexo Archives" src="http://www.fuglycode.com/wp-content/uploads/2010/03/flexo_archives_on.png" alt="Flexo Archives" width="145" height="157" /></a><p class="wp-caption-text">Flexo Archives</p></div>
<p><strong>The Recap</strong></p>
<p>Pros:</p>
<ul>
<li>Quick and easy install</li>
<li>Removes website/blog clutter</li>
<li>Easy to use</li>
</ul>
<p>Cons:</p>
<ul>
<li>JavaScript must be enabled</li>
<li>Stylesheets may need to be updated for bullet lists to match blog theme</li>
</ul>
<p>You can <a href="http://wordpress.org/extend/plugins/flexo-archives-widget/" target="_blank">find out more about Flexo Archives on the WordPress Plugins Directory</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuglycode.com/2010/03/10/blog-widgets-flexo-archives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<series:name><![CDATA[Blog Tools Review]]></series:name>
	</item>
		<item>
		<title>FuglyCode of the Week Article Series</title>
		<link>http://www.fuglycode.com/2010/03/09/fuglycode-of-the-week-article-series/</link>
		<comments>http://www.fuglycode.com/2010/03/09/fuglycode-of-the-week-article-series/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 12:53:18 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[fugly]]></category>
		<category><![CDATA[series]]></category>

		<guid isPermaLink="false">http://www.fuglycode.com/?p=162</guid>
		<description><![CDATA[Do you work with code?  Does the code you work with cause your hand to hit your forehead at least three times a day?  Is the code you work with Fugly?
If you&#8217;ve answered yes to any of these questions, then you may have FuglyCode!
Alright, big news on the FuglyCode front, we&#8217;re looking to start a [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_177" class="wp-caption alignright" style="width: 298px"><a href="http://www.fuglycode.com/wp-content/uploads/2010/03/sofugly1.jpg"><img src="http://www.fuglycode.com/wp-content/uploads/2010/03/sofugly1.jpg" alt="Its So Fugly..." title="Its So Fugly..." width="288" height="216" class="size-full wp-image-177" /></a><p class="wp-caption-text">Its So Fugly...</p></div><br />
<blockquote>Do you work with code?  Does the code you work with cause your hand to hit your forehead at least three times a day?  Is the code you work with Fugly?</p>
<p>If you&#8217;ve answered yes to any of these questions, then you may have FuglyCode!</p></blockquote>
<p>Alright, big news on the FuglyCode front, we&#8217;re looking to start a new series of articles that will be posted every Monday.  This series will focus on the fugliest code ever created, and how it can, and probably should, be corrected.</p>
<p>Now I&#8217;ve worked in software development for a long time, and I&#8217;ve seen my share of fugly code.  That being said, I&#8217;m also certain that I&#8217;m not the only one who&#8217;s had to read through, debug and reverse design fugly code.  So I&#8217;m looking for examples from you, the coders out there on the internet.</p>
<p>Send us examples and snippets of the most horrendous, scary looking code that you&#8217;ve ever had the pleasure (or not) to work with.  Every week, we&#8217;ll pick the fugliest of the bunch and try and figure out what went wrong.  We&#8217;ll then attempt to demonstrate how it should&#8217;ve been coded in the first place.</p>
<p>So if you have fugly code, <a href="http://www.fuglycode.com/contact-us/" target="_self">please submit it using the contact us form</a>.</p>
<p>And be sure to visit us next Monday to see some of the fugliest code out there!</p>
<p><em>A note about submitting code:</em></p>
<p><em>Feel free to submit your code in any coding language.  If possible, try to make your code as readable and as generic as possible.  <span style="font-style: normal;"><em><strong>Do not submit any private, protected or copyrighted code.</strong> Remove any personal or sensitive information from the code and rename any variables to generic, non-descriptive names.  The goal here is not to steal code from others, but rather to try and find proper design solutions for poorly written code.</em></span></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuglycode.com/2010/03/09/fuglycode-of-the-week-article-series/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Akismet</title>
		<link>http://www.fuglycode.com/2010/03/03/akismet/</link>
		<comments>http://www.fuglycode.com/2010/03/03/akismet/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 17:00:33 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://www.fuglycode.com/?p=130</guid>
		<description><![CDATA[Remember the days before spam?
- Akismet
I remember my very first spam email like it was yesterday.  I was looking at my good old hotmail inbox and wondering why I never got any emails when suddenly, as though an answer to my prayers, I received an email from someone I didn&#8217;t know.
Being both naive and confused, [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Remember the days before spam?</p>
<p>- <a href="http://www.akismet.com/" target="_blank">Akismet</a></p></blockquote>
<p>I remember my very first spam email like it was yesterday.  I was looking at my good old hotmail inbox and wondering why I never got any emails when suddenly, as though an answer to my prayers, I received an email from someone I didn&#8217;t know.</p>
<p>Being both naive and confused, I clicked reply, explained that I believed the senders had the wrong address, and clicked send.  It probably took a few weeks before I received my next spam email, and the next one came a few days after that, and the next a few hours, and so on.</p>
<p>Things are very different today, as spammers learn new tricks and spam takes on new forms, the tools at our disposal also evolve to protect us against such threats.  One of these tools is a blog plugin that I&#8217;ve been using since day 1 on my site, and will be the subject of today&#8217;s Blog Tools Review.  The name of the plugin: Akismet.</p>
<p><strong>Why spam a blog?</strong></p>
<p>If I had to guess, I would say that most people&#8217;s first encounter with spam is related to emails.  What&#8217;s important to remember, however, is that spam is not limited to email.  In fact, as a blogger, chances are that email spam will quickly become the least of your worries, and, without proper protection on your blog, you&#8217;ll soon be filtering through a barrage of comments to remove spam!</p>
<p>Now you may be wondering why a spammer would even bother with your blog.  The answer, simply put, is links.</p>
<p>You see, links on the internet are very important when it comes to increasing visitor traffic and increasing a site&#8217;s rank in search engine results.  It also turns out that blogs, by the very nature of their comment functionality, are a very easy target for spammers.</p>
<p><strong>So how can I protect my blog?</strong></p>
<div id="attachment_133" class="wp-caption alignright" style="width: 203px"><a href="http://akismet.com/stats/"><img class="size-full wp-image-133" title="Click on the image to see more Akismet Stats" src="http://www.fuglycode.com/wp-content/uploads/2010/03/akismet_stats.png" alt="Click on the image to see more Akismet Stats" width="193" height="82" /></a><p class="wp-caption-text">Click above to see Akismet stats</p></div>
<p>Well that&#8217;s where Akismet comes in.  Developed by the same people who developed Wordpress, Akismet is a self-learning spam detection service that filters over 14 million spam comments a day.</p>
<p>It offers an API that is not blog engine specific (meaning you can pretty much use it on any blog), and is free for personal use (they also offer different plans for corporate and commercial users).</p>
<p>Setup is very simple, especially in for Wordpress users, as all one needs to do is install the plugin and provide an API Key.  Such keys are provided by WordPress.com and Akismet.com, are free for personal users, and are used to limit abuse of the spam busting tool.</p>
<p>Once installed, the plugin will begin filtering any new comments posted on your site.  Any comments deemed to be spam will be put in a separate folder from which you can review and correct Akismet if it makes any mistakes (although you may not have to correct it often.  On my personal site, for example, Akismet has an accuracy rating of over 99%.)</p>
<p><strong>Review Recap</strong></p>
<p>Pros:</p>
<ul>
<li>Easy installation for WordPress users</li>
<li>Very efficient (over 99% accuracy) and learns from mistakes</li>
<li>Very flexible, can be used with a variety of online tools</li>
<li>Free for personal use and reasonable prices for professional or corporate use</li>
</ul>
<p>&nbsp;</p>
<p>Get more information on <a href="http://www.akismet.com/">Akismet&#8217;s web site</a> or the <a href="http://wordpress.org/extend/plugins/akismet/" target="_blank">WordPress Plugin Directory</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuglycode.com/2010/03/03/akismet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<series:name><![CDATA[Blog Tools Review]]></series:name>
	</item>
		<item>
		<title>Blog Tools Review Article Series</title>
		<link>http://www.fuglycode.com/2010/03/01/blog-tools-review-article-series/</link>
		<comments>http://www.fuglycode.com/2010/03/01/blog-tools-review-article-series/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 05:33:49 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[series]]></category>

		<guid isPermaLink="false">http://www.fuglycode.com/?p=124</guid>
		<description><![CDATA[As we begin to ramp up the different articles that will be published on FuglyCode.com, I&#8217;m proud to announce our first article series: Blog Tools Review.
Articles of this series will be posted every Wednesday around noon ET and will focus on the different tools, themes and plugins that I commonly use to make my blogs easier [...]]]></description>
			<content:encoded><![CDATA[<p>As we begin to ramp up the different articles that will be published on FuglyCode.com, I&#8217;m proud to announce our first article series: Blog Tools Review.</p>
<p>Articles of this series will be posted every Wednesday around noon ET and will focus on the different tools, themes and plugins that I commonly use to make my blogs easier to maintain and manage.  It was started on my personal site as a thank you to the open source community responsible for the creation of so many useful and free blogging tools, and will now become a regular part of FuglyCode.com.</p>
<p>If you have any ideas for blog tools that you&#8217;d like to see reviewed on FuglyCode.com, feel free to drop us a message using our <a href="http://www.fuglycode.com/contact-us/" target="_self">Contact page</a>.</p>
<p><a href="http://www.fuglycode.com/2010/02/03/blog-tools-review-blog-engine/">View the first Blog Tools Review</a></p>
<p><a href="http://www.fuglycode.com/series/blog-tools-review/" target="_self">View all Blog Tools Review articles in the series</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuglycode.com/2010/03/01/blog-tools-review-article-series/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plugins Introduction, WP-Cumulus</title>
		<link>http://www.fuglycode.com/2010/02/18/plugins-introduction-wp-cumulus/</link>
		<comments>http://www.fuglycode.com/2010/02/18/plugins-introduction-wp-cumulus/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 13:36:35 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://www.fuglycode.com/?p=117</guid>
		<description><![CDATA[So today we&#8217;re going to be diving into blog plugins, but before we do, I&#8217;d invite you to read the Blog Engine and Blog Themes post if you havn&#8217;t already done so, just to make sure we are all on the same page.
What&#8217;s a plugin?
Before we jump into reviewing the different plugins that I use [...]]]></description>
			<content:encoded><![CDATA[<p>So today we&#8217;re going to be diving into blog plugins, but before we do, I&#8217;d invite you to read the <a href="http://www.fuglycode.com/2010/02/03/blog-tools-review-blog-engine/" target="_self">Blog Engine</a> and <a href="http://www.fuglycode.com/2010/02/10/blog-tools-review-themes/" target="_self">Blog Themes</a> post if you havn&#8217;t already done so, just to make sure we are all on the same page.</p>
<p><strong>What&#8217;s a plugin?</strong></p>
<p>Before we jump into reviewing the different plugins that I use in my blogs, I think its a good idea to take a step back and understand what a plugin really is:</p>
<blockquote><p>Lets say your blog is a small, old car.  When we were setting up the blog&#8217;s theme, we were actually doing things like giving the car a new paintjob, putting some new leather on the seats, and hanging a pair of fuzzy dice on the rear-view mirror (oh yea!).</p>
<p>Now that we have a pretty hot ride, we start to focus on making the car run, and begin installing upgrades like new tires, new suspensions and a lower frame.  These upgrades, while not changing the basic functionality of the car, make it run smoother, and to our taste.  This is the nature of a blog plugin.</p></blockquote>
<p>So a plugin is a small piece of code that adds to or changes the functionality of your blog.  They come in all shapes and sizes (from simple to very complex), most of which are created and can be used for free on your blog.  With time, you will learn to master the art of including plugins on your blog seamlessly.  This will allow you to add new functionality to your blog, while not distracting your visitors.</p>
<p><strong>Our First Plugin Review: WP-Cumulus</strong></p>
<p><strong> </strong></p>
<div id="attachment_121" class="wp-caption alignright" style="width: 289px"><a href="http://www.fuglycode.com/wp-content/uploads/2010/02/wp-cumulus.jpg"><img class="size-full wp-image-121" title="WP-Cumulus on Folaji.com" src="http://www.fuglycode.com/wp-content/uploads/2010/02/wp-cumulus.jpg" alt="WP-Cumulus on Folaji.com" width="279" height="264" /></a><p class="wp-caption-text">WP-Cumulus on Folaji.com</p></div>
<p>For our first blog review, we&#8217;ll be looking at one of my favorite plugins: WP-Cumulus.  This plugin takes your blog&#8217;s tags, categories, or both, and creates a 3D floating cloud of clickable links, which is then displayed in your blog&#8217;s sidebar.</p>
<p>Not only is the 3D rendered &#8220;cloud&#8221; visually appealing, it also engages your visitors, allowing them to skim through all of your blog&#8217;s content with the quick movement of a mouse.  The plugin is very easy to install and configure, and allows you to set the tag cloud&#8217;s colours and size to any RGB value.</p>
<p>For those of you that are concerned about the information being lost to search engine bots, WP-Cumulus will display a normal list of tags to any visitor that does not have Flash 9 or higher installed and javascript enabled.  Although some users might like this functionality, I see it more as a double edged sword.  Yes, the search engine bots will be able to crawl your site using tags, but this also means that anybody who doesn&#8217;t have Flash 9 and javascript enabled won&#8217;t see WP-Cumulus, but isntead will see the normal list of tags (which is not as professional looking as the 3D tag cloud itself).</p>
<p>So I say take the time to download and install this plugin.  Even if you don&#8217;t end up using it, its fun to setup and test (and who knows, you might just keep it on your site after giving it a test drive).</p>
<p>The WP-Cumulus plugin is available for WordPress self hosted blogs free of charge, and can be downloaded from the <a href="http://wordpress.org/extend/plugins/wp-cumulus/" target="_blank">Wordpress.org Plugin Directory</a>.</p>
<p><strong>Review Recap</strong></p>
<p>Pros:</p>
<ul>
<li>Beautiful and professional looking</li>
<li>Very easy to install and configure</li>
<li>Customizable height, width and colours</li>
<li>Displays normal tag cloud to visitors without flash (useful for search engine bots)</li>
</ul>
<p>Cons:</p>
<ul>
<li>Requires Flash 9 (or better) and javascript enabled</li>
<li>May not be available to all blog visitors and browsers (ie: doesn&#8217;t seem to work in Internet Explorer 6)</li>
</ul>
<p>&nbsp;</p>
<p><a href="http://wordpress.org/extend/plugins/wp-cumulus/" target="_blank">Download WP-Cumulus here!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuglycode.com/2010/02/18/plugins-introduction-wp-cumulus/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<series:name><![CDATA[Blog Tools Review]]></series:name>
	</item>
		<item>
		<title>Welcome to FuglyCode!</title>
		<link>http://www.fuglycode.com/2010/02/13/welcome-to-fuglycode/</link>
		<comments>http://www.fuglycode.com/2010/02/13/welcome-to-fuglycode/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 03:41:13 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Announcements]]></category>

		<guid isPermaLink="false">http://www.fuglycode.com/?p=98</guid>
		<description><![CDATA[Welcome to FuglyCode.com, the site that shows you how to code, by showing you how not to code!
As you can see, our site is quite empty at the moment, and that&#8217;s mostly because we just launched.   Rest assured that we are working very hard at preparing some interesting articles about good software practices, common [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to FuglyCode.com, the site that shows you how to code, by showing you how not to code!</p>
<p>As you can see, our site is quite empty at the moment, and that&#8217;s mostly because we just launched.   Rest assured that we are working very hard at preparing some interesting articles about good software practices, common development issues, and, of course, fugly code.</p>
<p>So please bear with us while we get ready.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuglycode.com/2010/02/13/welcome-to-fuglycode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
