<?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>Blurry Words</title>
	<atom:link href="http://www.blurrywords.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blurrywords.com</link>
	<description>Opinions and Experiences from another idiot programmer.</description>
	<lastBuildDate>Sat, 10 Oct 2009 19:04:00 +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>Partial Functions and Enforcing Extension</title>
		<link>http://www.blurrywords.com/2009/10/10/partial-functions-and-enforcing-extension/</link>
		<comments>http://www.blurrywords.com/2009/10/10/partial-functions-and-enforcing-extension/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 19:04:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Object Oriented Stuff]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Object Oriented Programming]]></category>
		<category><![CDATA[programming language discussion]]></category>

		<guid isPermaLink="false">http://www.blurrywords.com/2009/10/10/partial-functions-and-enforcing-extension/</guid>
		<description><![CDATA[I like playing around with other programming languages from time to time, just to see how or what they do differently than the core languages that I work with every day.  So this morning I was spending some time with C#.  I’ve actually done some development in C# in the past.  About three years ago [...]]]></description>
			<content:encoded><![CDATA[<p>I like playing around with other programming languages from time to time, just to see how or what they do differently than the core languages that I work with every day.  So this morning I was spending some time with C#.  I’ve actually done some development in C# in the past.  About three years ago now, I think it was that long ago…maybe longer, I used it to develop both a Sprite Editing tool and a Level Designer.  So I’m “familiar” with the language, but basically have etch-a-sketched what makes it unique from Java.</p>
<p>My rediscovery of C# got me thinking about function modifiers, mainly because C# and Java have countering approaches to handling virtual functions.  In Java your a virtual function unless declared otherwise by using the final modifier (private methods are probably not considered virtual either).  But in C# it’s the exact opposite.  Your virtualality (is that a word?) needs to be explicitly declared by using…wait for it…the virtual modifier.</p>
<p>Another difference is in the subclasses.  Again, C# seems to be much more explicit about this kind of stuff.  You must use the override modifier to declare that your overriding a virtual function.  In Java you really don’t have to do anything, just make sure you have the same name and parameters.  Sure, that @Override thing’s been tacked on to newer versions of Java.  This helps the compiler make sure that the virtual method actually exists in the superclass, but you don’t have to use it if you don’t want to.  C# makes you use it, which in turn ensures of your intentions.</p>
<p>Are these differences a big deal?  Not really.  My preference would probably be with the way C# accomplishes it, as it allows you to be more explicit in your intentions without being anymore verbose about it, which results in clear, easier to maintain code.</p>
<p>But the purpose of this post is where my mind went when considering the way virtual functions are handled in both languages.  There happens to be a big hole in the amount of control that the superclass can take over its virtuals.  In both languages, actually any language I’ve worked with for that matter, the superclass has little to no control on whether or not the subclass inherits the functionality provided by a virtual function.  If the subclass feels it needs the superclass&#8217;s implementation as well as some additional stuff, then it can easily call upon the provided code by doing super.FuncName() in Java or base.FuncName() in C# within the overridden function.  But, what if the superclass wants to force the subclass to use the code its virtual function has provided?  What if it just wants to provide the subclass with the ability to extend a method and not completely override it?  <strong>Both languages need what I’m calling, the partial function modifier.</strong></p>
<p>For those that haven’t stop reading, a partial function would be a function declared and defined by the superclass that provides some functionality that needs to be apart of every subclass’s implementation of that function.  The subclass would only be able to extend, using the extend modifier of course, the function and provide further logic that is specific to the subclass’s needs.  Similar to an abstract class, the partial function would be required to be extended, or have its class marked abstract, as by marking a function as partial the superclass is basically saying, <em>“Hey, this method, the code it implements…it’s required but the function is still unusable unless you provide the functionality needed to complete it.”</em></p>
<p>Here’s a usage example to show…what else, it’s usefullness.  Let’s say you have an abstract GameState class.  This class should be inherited by every different game state that your game has.  You’d probably have a subclass for the main menu, gameplay, submitting highscores, and so forth and blah.</p>
<p>The GameState class will need to define methods for loading, drawing and updating.  Each method will need to be implemented by every subclass.  You start off by making all three of the methods abstract.  But then you start creating some subclasses and realize that each and every call to Update should query for actions by the user.  Did they press a key, did they select something…stuff like that.  So you turn the Update method into a virtual method (lets think in C# on this one) and implement the querying functionality for the user’s actions.  Now each subclass just needs to override Update and call base.Update() within it in order to take advantage of the functionality provided by the superclass.</p>
<p>That seems like a perfectly acceptable way of implementing the Update function.  But what ends up happening from then on is that every time you create a new game state and go about setting up your Update method, you forget that you need to make the base.Update call.  So you start testing the new state, no user input works and you smack yourself in the head for forgetting that same stupid call once again.  Now if you had a partial function, the burden is on the superclass to make sure that that part of the code is implemented every time.  And the superclass has no problem with that…mainly because, well, it’s SUPER.  Sorry, that’s lame but I’m leaving in it.</p>
<p>Anyways, would a partial method modifier really save you oodles of time…probably not.  But the point is more that the superclass should be able to control this kind of circumstance, not the subclass.  And right now the subclass is piloting the ship.  Partial methods ensure that the vital code of a method, and we can assume that it is vital because otherwise there wouldn’t be a reason to force the subclass into using it, is being run before anything else the subclass might tack on to execute.  A little more complexity can be hidden and a little less burden can be put on the subclasses, neither of which are ever bad things.</p>
<p>I’d love to hear what I’m missing on this idea or why it wouldn’t work or how stupid I am, or even if there is a language out there that already implements such a feature.  Any conversation on this would be good.  Let me know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blurrywords.com/2009/10/10/partial-functions-and-enforcing-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BlackBerry Gotcha #00001</title>
		<link>http://www.blurrywords.com/2009/09/19/blackberry-gotcha-00001/</link>
		<comments>http://www.blurrywords.com/2009/09/19/blackberry-gotcha-00001/#comments</comments>
		<pubDate>Sat, 19 Sep 2009 17:36:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[BlackBerry Gotchas]]></category>

		<guid isPermaLink="false">http://www.blurrywords.com/2009/09/19/blackberry-gotcha-00001/</guid>
		<description><![CDATA[
Can’t Find javac…
The first post of the BlackBerry Gotchas category starts where you might start off if you venture into BlackBerry development.&#160; It has to do with getting the JDE properly installed.&#160; 
The overall process for installing the JDE is straight forward, just download and follow the installation instructions that follow.&#160; However, after you create [...]]]></description>
			<content:encoded><![CDATA[<h1></h1>
<h1>Can’t Find javac…</h1>
<p>The first post of the BlackBerry Gotchas category starts where you might start off if you venture into BlackBerry development.&#160; It has to do with getting the JDE properly installed.&#160; </p>
<p>The overall process for installing the JDE is straight forward, just download and follow the installation instructions that follow.&#160; However, after you create the de facto “Hello, World!” application and you attempt to compile, you may run into the following error:</p>
<blockquote><p>I/O Error: Cannot run program &quot;javac&quot;: CreateProcess error=2, The system cannot find the file specified     <br />Error while building project</p>
</blockquote>
<p>Not a great way to start, but not a huge problem to fix.&#160; Most modern day IDEs now ask for the installation location of your Java Development Kit (JDK) during the installation process.&#160; However, the JDE relies on the system to inform it of where the JDK is located.&#160; This means that you need to make sure that you specify your JDK’s bin directory in your PATH variable.&#160; You can do this permanently by opening up the “Systems Properties” dialog and under the “Advanced” tab clicking on the “Environment Variables…” button.&#160; Now find the PATH variable in the “Systems Variables” list and add &lt;PATH TO JDK HOME&gt;/bin to is.</p>
<p>Once your done with that, reload your JDE and compiling should commence with only issue that are of your own doing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blurrywords.com/2009/09/19/blackberry-gotcha-00001/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bing vs. Google &#8211; The Results Show!</title>
		<link>http://www.blurrywords.com/2009/09/12/bing-vs-google-the-results-show/</link>
		<comments>http://www.blurrywords.com/2009/09/12/bing-vs-google-the-results-show/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 16:58:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Software Reviews]]></category>
		<category><![CDATA[bing vs google]]></category>

		<guid isPermaLink="false">http://www.blurrywords.com/2009/09/12/bing-vs-google-the-results-show/</guid>
		<description><![CDATA[Let’s be blunt about this.&#160; No reality competition cliff hangers. No right after this commercial break.&#160; Let’s just dive right in for those that have no interest in staying ‘til the end.&#160; 
Basically, from my perspective…Google’s still king!
As I stated in my previous post to set up my intentions for this comparison, I made Bing [...]]]></description>
			<content:encoded><![CDATA[<p>Let’s be blunt about this.&#160; No reality competition cliff hangers. No right after this commercial break.&#160; Let’s just dive right in for those that have no interest in staying ‘til the end.&#160; </p>
<p>Basically, from my perspective…Google’s still king!</p>
<p>As I stated in <a href="http://www.blurrywords.com/2009/06/15/bring-it-on-bing-vs-google/">my previous post</a> to set up my intentions for this comparison, I made Bing my default search provider in Chrome for what I consider a “significant” length of time.&#160; That turned out to be a couple of months.&#160; If Bing gave me search results that were useful relative to my needs, then it got a tick mark.&#160; If it didn’t, I jumped over to Google to see what its take on the same search would be.&#160; If Google came up with something useful, it got the tick mark.</p>
<p>It should be noted that I realize this isn’t a very scientific process.&#160; Trust me, I’ve had it pointed out to me several times by those that noticed the accumulation of tick marks on my whiteboard.&#160; I get it, it’s a bit hack.&#160; But at the same time, determining which search engine provides better results is a completely subjective process that could never truly be scientifically analyzed anyways.&#160; So, I deem my process good enough for my needs and good enough to blog about.</p>
<p>As you might have guessed from me giving away the punch-line at the start of this post, Bing was a bit of a disappointment.&#160; It turns out that about 30% of the time Bing gave me an answer that I didn’t find useful and Google was able to provide something better.&#160; That’s a fairly significant amount of the time, certainly not good enough to be named my default going forward…or to even give it a chance at a one to one comparison with Google.&#160; It just didn’t cut it.</p>
<p>Beyond the 30% fail rate though, what really started to bother me about Bing was its rigidity and inability to cope with my mistakes.&#160; Mistakes like me making a typo.&#160; Where Google seamlessly adapts to such a mistype by its users, Bing responds with something like so:</p>
<p><a href="http://www.blurrywords.com/wordpress/wp-content/uploads/2009/09/bing_checkstyle.png"><img title="bing_checkstyle" style="border-right: 0px; border-top: 0px; display: block; float: none; border-left: 0px; border-bottom: 0px" height="385" alt="bing_checkstyle" src="http://www.blurrywords.com/wordpress/wp-content/uploads/2009/09/bing_checkstyle_thumb.png" width="587" border="0" /></a>Not being able to adapt and push forward through such a typo is just not acceptable anymore.&#160; Google handled it perfectly without any further effort out of me.&#160; It recognized that there was a 99% chance that I was talking about <a href="http://checkstyle.sourceforge.net/">checkstyle</a>, a software development tool for adding code convention checking to your build process, and gave me the results for its assumption.&#160; While on the other hand, Bing just stood there with a dumb look on its face like it had no freaking idea what the hell I was talking about.</p>
<p>So Google’s officially back as my default browser.&#160; Though this comparison was enough to convince me&#160; of its superiority, you shouldn’t let it convince you.&#160; As I said, I had this test on my whiteboard for two months.&#160; Anyone that saw it had an opinion on this and some of those opinions were that Bing definitely supplied more natural, useful results than Google.&#160; You basically just need to figure out what works best for you and go with it.&#160; Bing has a lot of functionality and is far superior than all past challengers of Google’s space.&#160; But for me, it still falls short.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blurrywords.com/2009/09/12/bing-vs-google-the-results-show/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blur #00012</title>
		<link>http://www.blurrywords.com/2009/09/07/blur-00012/</link>
		<comments>http://www.blurrywords.com/2009/09/07/blur-00012/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 18:05:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Blog Format Change]]></category>
		<category><![CDATA[Quick Update]]></category>

		<guid isPermaLink="false">http://www.blurrywords.com/?p=415</guid>
		<description><![CDATA[I&#8217;ve reorganized Blurry Words again.  Now all Blurs will be inline with the rest of my post.  I&#8217;m mainly making this change as I&#8217;ve had a few blurs that went unwritten due to the fact that I had no space to include an image or another type of media.  Though I liked having the blurs [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve reorganized Blurry Words again.  Now all Blurs will be inline with the rest of my post.  I&#8217;m mainly making this change as I&#8217;ve had a few blurs that went unwritten due to the fact that I had no space to include an image or another type of media.  Though I liked having the blurs on the left sidebar, this should allow a little more flexibility, which is the main reason for having the blurs in the first place.</p>
<p>Also, I hope to have some new useful content up here in the near future.   My wife gave birth to our daughter four weeks ago today.   On top of that we just bought a house as well.   So, it would be an understatement to say that I&#8217;ve been preoccupied.</p>
<p>But, I do want to get back to it.   I have the conclusion to my <a href="http://www.blurrywords.com/2009/06/15/bring-it-on-bing-vs-google/">Bing vs. Google comparison</a> and I plan to add a new subcategory to the BlackBerry category called, <strong>BlackBerry Gotchas</strong>.  These will be shorter posts that allow me to document quirks and other nuisances of BlackBerry development that are not always so obvious and may cause developer some undesired grief (and possibly already have for myself).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blurrywords.com/2009/09/07/blur-00012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blur #00011</title>
		<link>http://www.blurrywords.com/2009/08/06/blur-00011/</link>
		<comments>http://www.blurrywords.com/2009/08/06/blur-00011/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 13:09:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blurs]]></category>
		<category><![CDATA[Gears of War 2]]></category>
		<category><![CDATA[video games]]></category>
		<category><![CDATA[Xbox Achievements]]></category>

		<guid isPermaLink="false">http://www.blurrywords.com/2009/08/06/blur-00011/</guid>
		<description><![CDATA[There’s something about Xbox achievements that drives the way I play.&#160; Chasing achievements is part of the experience and definitely extends the life of a game.&#160; The whole system has been a huge success.&#160; With that said, the point of this Blur is to bitch about how the achievement system is wrecking Horde Mode in [...]]]></description>
			<content:encoded><![CDATA[<p>There’s something about Xbox achievements that drives the way I play.&#160; Chasing achievements is part of the experience and definitely extends the life of a game.&#160; The whole system has been a huge success.&#160; With that said, the point of this Blur is to bitch about how <strong>the achievement system is wrecking Horde Mode in Gears of War 2</strong>.&#160; </p>
<p>With the latest Dark Corners downloadable content, tied with a great deal to bundle it with the rest of the released map packs, I jumped back in for some more Gears this week.&#160; I was done, I put it a way to spend some more time with my other neglected games.&#160; But, now I’m back…damn you Epic.</p>
<p>Horde mode has been my focus.&#160; And, because I’m hugely driven by achievement earning, my decision on which map to play is completely driven by <strong>Gamerscore Greed</strong>.&#160; And, it’s not just me.&#160; It seems like the whole community is thinking the same thing.&#160; </p>
<p><strong>Getting a complete 5 man team of randoms is now officially impossible</strong>.&#160; Players don’t get the map they need, they drop.&#160; You usually end up with 2 or 3 guys trying to take on the horde, which becomes nearly impossible around level 9 or 10 (yes, playing with friends that you communicate with makes it less impossible, but with a bunch of silent randoms…no way).</p>
<p>Since most achievements revolve around reaching level 10, this turns into a pretty frustrating experience.&#160; Quite a waste of time.&#160; I’m sure this wasn’t the intended behavior, but it surely has created an annoying monster.&#160; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.blurrywords.com/2009/08/06/blur-00011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blur #00010</title>
		<link>http://www.blurrywords.com/2009/07/26/blur-00010/</link>
		<comments>http://www.blurrywords.com/2009/07/26/blur-00010/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 15:32:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blurs]]></category>
		<category><![CDATA[1 vs 100]]></category>
		<category><![CDATA[blur]]></category>
		<category><![CDATA[video games]]></category>

		<guid isPermaLink="false">http://www.blurrywords.com/?p=410</guid>
		<description><![CDATA[I finally remembered to take in a live 1 vs. 100 last night.  It took sticking a big orange post-it to the tv for me to remember, but I remembered.  And it was worth the effort, even if I didn&#8217;t get to be THE ONE, or in the Mob, the audience is still a pretty [...]]]></description>
			<content:encoded><![CDATA[<p>I finally remembered to take in a live 1 vs. 100 last night.  It took sticking a big orange post-it to the tv for me to remember, but I remembered.  And it was worth the effort, even if I didn&#8217;t get to be THE ONE, or in the Mob, the audience is still a pretty fun experience.  You&#8217;re paired up with three other randoms and you compete against them for fun and pride, but you&#8217;re also striving to be one of the top scorers in the audience for the round.  This results in prizes&#8230;free XBLA games!</p>
<p>Anyways, it worth checking out.  Hopefully I&#8217;ll make it to the mob next time, but even if I don&#8217;t it&#8217;s still fun to answer some trivia questions, yell at The One to take the money and get your avatar dancing (hint: pound the shit out of <strong>Y</strong>).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blurrywords.com/2009/07/26/blur-00010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blur #00009</title>
		<link>http://www.blurrywords.com/2009/07/19/blur-00009/</link>
		<comments>http://www.blurrywords.com/2009/07/19/blur-00009/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 14:52:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blurs]]></category>
		<category><![CDATA[blog opinion]]></category>
		<category><![CDATA[post width]]></category>

		<guid isPermaLink="false">http://www.blurrywords.com/?p=407</guid>
		<description><![CDATA[Limit the width of your posts.  The blogs that dynamically adjust the width of their posts to match the window resolution usually results in me not reading them.  Sorry, but it&#8217;s unpleasant to read a 700 word post on one line.  That&#8217;s a bit of an exaggeration, but with larger resolutions you can still end [...]]]></description>
			<content:encoded><![CDATA[<p>Limit the width of your posts.  The blogs that dynamically adjust the width of their posts to match the window resolution usually results in me not reading them.  Sorry, but it&#8217;s unpleasant to read a 700 word post on one line.  That&#8217;s a bit of an exaggeration, but with larger resolutions you can still end up having horribly formatted posts.</p>
<p>Supposedly 70 to 80 characters per line is optimal.  I don&#8217;t think you have to go that narrow, but have some kind of max boundary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blurrywords.com/2009/07/19/blur-00009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java’s Coding Convention Hmmms…</title>
		<link>http://www.blurrywords.com/2009/07/11/javas-coding-convention-hmmms/</link>
		<comments>http://www.blurrywords.com/2009/07/11/javas-coding-convention-hmmms/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 14:34:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[programming language discussion]]></category>

		<guid isPermaLink="false">http://www.blurrywords.com/2009/07/11/javas-coding-convention-hmmms/</guid>
		<description><![CDATA[I spent an hour or so the other night refreshing my knowledge of Sun’s official coding convention for Java.  Obviously these are just suggestions and you don’t have to follow them at all, though I’ve made it clear that I would be in full support of a language that did enforce such a standard in [...]]]></description>
			<content:encoded><![CDATA[<p>I spent an hour or so the other night refreshing my knowledge of Sun’s official coding convention for Java.  Obviously these are just suggestions and you don’t have to follow them at all, though I’ve made it clear that I would be in full support of a language that did enforce such a standard in my post <a href="http://www.blurrywords.com/2008/11/26/standard-style-why-not/">standard style post</a>.  Nevertheless, there are a few suggestions in the documentation that make me wonder why support wasn’t just built into the language for them even if they didn’t want to completely support a coding convention through the compiler.</p>
<p>The fact that these are part of the convention says to me that someone at least considered these items possible problem areas.  Were they banished to the convention in order to avoid building any barriers that might deter C/C++ programmers from adopting Java in the early years?  Maybe the convention just came later.  Or maybe it has been edited several time since the language was originally developed and these items were just oversights that can’t be fixed at this point.  This is certainly a possibility considering how easily a convention can be changed compared to the language itself.</p>
<h1>/* falls through */</h1>
<p>I think switch case statement fall-through is a bad thing in its only supported form, as I mentioned in my <a href="http://www.blurrywords.com/2008/11/20/simple-rules/">simple rules post</a> from a while back.  It shouldn’t be allowed without the compiler being able to have some kind of control over it, and I think Sun knows this.  The switch statement below is directly from the coding convention.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>condition<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">case</span> ABC<span style="color: #339933;">:</span>
        statements<span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">/* falls through */</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">case</span> DEF<span style="color: #339933;">:</span>
        statements<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">case</span> XYZ<span style="color: #339933;">:</span>
        statements<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">default</span><span style="color: #339933;">:</span>
        statements<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>In my opinion the <strong>/* falls through */</strong> comment is just hack.  Imagine you have a wall in your house where a 2&#215;4 is missing.  So, at one position on the wall there is a span of 32 inches without a beam and the wall is a little less stable in that vertical strip, a little less likely to support weight.  So, to avoid a drunken idiot, or just a normal idiot, from breaking through the wall, you write in big red letters, “Weak Spot” in the problem area.  Problem solved, unless the drunken idiot didn’t notice it as he was too busy crashing through your new lamp that you just picked up at IKEA over the weekend.</p>
<p>An open manhole cover is another, possibly more realistic analogy.  It’s likely that an open manhole cover will have some kind of visual warning similar to the /* falls through */ comment.  Possibly orange cones.  The only difference is the manhole is only open temporarily, it’s not a permanent situation.  Also, they use bright orange cones, an object out of the ordinary.  Comments are usually all over the place in code and quickly are filtered by your SEP field.</p>
<p>There might be nothing they can do about it now considering that there are way too many applications out there developed with Java that might just stop working if they made such changes to the language, but it is still a pretty hack solution to the issue.  They would serve new developers better by just telling them not to use case fall-through.</p>
<p>In the most hindsite, snooty, Monday morning quarterback way, they should have done something like this.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>condition<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">case</span> ABC<span style="color: #339933;">:</span>
        statements<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">continue</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">case</span> DEF<span style="color: #339933;">:</span>
        statements<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">case</span> XYZ<span style="color: #339933;">:</span>
        statements<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">default</span><span style="color: #339933;">:</span>
        statements<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Use the <strong>continue</strong> keyword to allow case fall-through.  Or they could’ve created a <strong>fall </strong>keyword; maybe even, gasp, a goto &lt;case&gt; type of implementation.  Anything that gives the compiler control over case fall-through is better than nothing…er, having a /* falls through */ comment.</p>
<h1>Statements Always Use Braces</h1>
<p>I always use braces…always.  I can’t stand the look of of the following in my code:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>condition<span style="color: #009900;">&#41;</span>
        doSomething<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>It just comes off as messy to me, not uniform with the rest of the code. I think it&#8217;s perfectly acceptable in a language like Python as code blocks are defined by indentation, not opening and closing curly brackets.  But, in languages that rely on braces, you shouldn’t be allowed to define a code block any other way.  And again, it seems the developers of Java agree with this.  Section 7.2 of the coding convention states:</p>
<blockquote><p>Braces are used around all statements, even single statements, when they are part of a control structure, such as a <code>if-else</code> or <code>for</code> statement. This makes it easier to add statements without accidentally introducing bugs due to forgetting to add braces.</p></blockquote>
<p>I’m going to chalk the decision to not put this in the language up to staying inline with the supported syntax of C/C++.  Programmers are fussy prima donnas.  You don’t mess with their preferences, even if there preferences are completely wrong.</p>
<p>The fact that this isn’t a part of the language isn’t a big deal, but if I see an if statement missing curly brackets in code I’m working on,  I’m compelled to add them.  And you should be too.</p>
<h1>Public, Private, Protected…why not Package?</h1>
<p>Recently I&#8217;ve been seeing this a lot in code I&#8217;ve been working on.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*package*/</span> <span style="color: #000000; font-weight: bold;">class</span> SomeClass <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> someVariable<span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">/*package*/</span> <span style="color: #003399;">Object</span> someVariable2<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>It irritates the shit out of me.  If you spend ten freaking minutes working in Java it’s likely that you will learn, or figure out that the absence of an access modifier makes the member/class public to the package, but private to the world.  But, it does make me wonder why they didn’t just go the extra step and make a <strong>package</strong> access modifier.  It neatly falls in line with the length and first letters of the other access modifiers; it seems like it would have been a natural part of the language.  Also, it would keep my code looking slightly more uniformed.  The variable name for private, protected and public variables all start in nearly the same location.  Then you have the package variables that start way before anything else…or at least a couple of characters.</p>
<p>I know, this one’s a bit nitpicky.  Unlike the other two, having a <strong>package </strong>modifier doesn’t help fend against introducing defects.  It’s completely a visual preference of mine.  It doesn’t matter.  However, putting the /*package*/ is way worst than just having nothing at all, so just don’t do it.  All that says to me is that the programmer was too stupid to remember that the member would only be able to be accessed by other members of the package.  You don’t want me thinking you’re stupid, do you?</p>
<h1>Anyways&#8230;</h1>
<p>I understand that creating a flawless language is hard, if not impossible.  I also understand that this stuff is subjective and you may not agree with it.  And I also realize that even if Sun now believes this stuff should be enforced by Java’s compiler that it will never happen due to the fact that many companies and developers rely on their shit being consistent with what is already available.  But, that doesn’t mean I can’t point out their flaws from atop my safe little mountain of hindsight.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blurrywords.com/2009/07/11/javas-coding-convention-hmmms/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Blur #00008</title>
		<link>http://www.blurrywords.com/2009/06/27/blur-00008/</link>
		<comments>http://www.blurrywords.com/2009/06/27/blur-00008/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 13:49:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blurs]]></category>
		<category><![CDATA[best linux web browser]]></category>
		<category><![CDATA[google chrome]]></category>
		<category><![CDATA[linux mint]]></category>

		<guid isPermaLink="false">http://www.blurrywords.com/2009/06/27/blur-00008/</guid>
		<description><![CDATA[I&#8217;ve been experimenting with Linux over the past month.  Linux Mint to be precise.  Just Quickly, it&#8217;s been five years since I&#8217;ve used Linux, which happens to correspond with graduating from college.  So, I figured I would take my now not used desktop and do some exploring.  I&#8217;m very happy with the experience so far, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been experimenting with Linux over the past month.  <a href="http://www.linuxmint.com">Linux Mint</a> to be precise.  Just Quickly, it&#8217;s been five years since I&#8217;ve used Linux, which happens to correspond with graduating from college.  So, I figured I would take my now not used desktop and do some exploring.  I&#8217;m very happy with the experience so far, but that&#8217;s for another post.</p>
<p>What I wanted to mention was that even in its pre-release developer state, <a href="http://www.google.com/chrome/intl/en/linux.html">Google Chrome Linux</a> is still the best internet browser I&#8217;ve fired up.  <a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a> is solid but feels a bit sluggish, and <a href="http://www.opera.com/">Opera&#8217;s</a> page rendering is embarrassingly slow.  I was starting to think it was my connection, or something with Linux&#8230;not true.  Chrome friggin&#8217; rips, just as you may have come to expect from it on other platforms.  Being pre-release you run the risk of it being a bit buggy, but I haven&#8217;t had any issues to this point and I certainly wouldn&#8217;t let that stop you from giving it a try.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blurrywords.com/2009/06/27/blur-00008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Bad of Warnings as Errors</title>
		<link>http://www.blurrywords.com/2009/06/24/the-bad-of-warnings-as-errors/</link>
		<comments>http://www.blurrywords.com/2009/06/24/the-bad-of-warnings-as-errors/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 01:21:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Productivity]]></category>
		<category><![CDATA[productive programming]]></category>
		<category><![CDATA[warnings as errors]]></category>

		<guid isPermaLink="false">http://www.blurrywords.com/2009/06/24/the-bad-of-warnings-as-errors/</guid>
		<description><![CDATA[I&#8217;m going to go out on a limb here to make a point that treating warnings as errors can be a bad thing.  I think there is a place and a time for such requirements.  When code has reached the testing or maintenance part of its life-cycle, treating warnings as errors makes a lot of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to go out on a limb here to make a point that treating warnings as errors can be a bad thing.  I think there is a place and a time for such requirements.  When code has reached the testing or maintenance part of its life-cycle, treating warnings as errors makes a lot of sense.  It results in higher quality, more accurate code, cleaner build results and possibly a better overall product (though I don&#8217;t see how a rogue unused import statement would make any difference when it comes to the perceived quality of the product).</p>
<p>With that said, it has no place in the implementation process.  Instead of a tool for writing better code, it has the ability to manifest itself into a big waste of time and a destroyer of the elusive &#8220;flow&#8221;.</p>
<p>Recently I&#8217;ve been working on a feature that requires communication between a couple of different layers.  In one layer I&#8217;ve set up an event listener/dispatcher to listen for events from the other layer.  The dispatcher then calls upon an event processor that does what is needed for each event and passes the results back to the other layer through a callback function.  I created an interface to wrap the callbacks so I can set up a test environment that points to some fake callback functions until the other layer&#8217;s actual callbacks are in place.  I then created a variable for the callbacks within the event processor with the intent on using it later, but before that it was to define my class design a little more clearly within the code.</p>
<p>Before getting the callback stuff working, I needed to get the event communication between the two layers working properly.  I spent about an hour working out the details before I attempted to build and see how well I had progressed.  All my syntax seemed fine, thanks to the power of the modern IDE.  So I was pretty sure it would at least compile.  Running properly was a completely different story, but I thought I would at least have a build that I can get on the device and start debugging.  I fired off the build and about five to six minutes later&#8230;</p>
<p><span style="color: #cc0000;"><strong> &#8220;You dumb shit. The variable _callback is never used. I could just keep building and let you off with a warning&#8230;screw you, bitch. Error!&#8221;<br />
</strong></span></p>
<p>Okay, so my compiler isn&#8217;t that big of a douche, but it might as well be as it just puked on a warning during a build process that takes around 10 to 15 minutes to complete, depending on what you changed, all because of a variable being unused.  A variable that I expected to be unused at this point as it is just there as a place-holder for me to visually see the design of my future implementation.  Any flow I had going is completely shot at this point, as you might have expected.  There&#8217;s nothing else for me to do but let out a sigh, comment out the variable, start the build again and go get some coffee.</p>
<p>When I returned the build had aborted&#8230;again!  This time it&#8217;s due to a package being imported that isn&#8217;t being used; the same package needed for the callback variable that I just commented out.</p>
<p><span style="color: #cc0000;"><strong> &#8220;Hey idiot, you don&#8217;t use this package. Error bitch!&#8221;<br />
</strong></span></p>
<p>Now that&#8217;s twice the compiler has called me bitch.  Twice!  All I can do is go the rout of Jim Carrey in Liar Liar; piss, moan, bend over, take in tailpipe.  Comment out the import statement, start the build process and make some notes in my notebook to write a post complaining about warning as errors.</p>
<p>So, you can see my point about it being a bad thing.  Anything that decreases your productivity needs to be considered a bad thing.  The question that I&#8217;ve been pondering though is, is it worth turning warnings being treated as errors off in my local environment during the implementation stage of a new feature?  Do I dare risk becoming the ass hole that broke the nightly build because I didn&#8217;t turn warnings as errors back on before submitting my changes to the depot?  Yeah, that&#8217;s all I want is it to be the jerk that thinks he&#8217;s better than treating warnings as errors.  I don&#8217;t think so.</p>
<p>So, I&#8217;m dealing with it.  I&#8217;ve made some adjustments in my IDE to make it more obvious that I have potential warnings that will break a build process.  Mainly, I&#8217;ve adjusted the color of the squiggly line color from a barely visible whiteish yellow to the blazing red of the error messages.  I&#8217;m thinking this might need to change to a different color to avoid me having to decipher whether the marked code is actually an error or a warning, but &#8220;you&#8217;re freaking screwed&#8221; red is fine for now.</p>
<p>I also use a lot of //TODO comments now to layout the skeleton of classes.  It&#8217;s not as pretty, but at least the IDE generates a nice task list based on them for me to reference.  All and all I&#8217;m still not for treating warnings as errors so early in the development process, but sometimes a slightly less productive setting for yourself can be much better than possibly slamming your whole development team&#8217;s productivity against a brick wall.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blurrywords.com/2009/06/24/the-bad-of-warnings-as-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
