<?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>Jarrod Roberson: Programming Missives</title>
	<atom:link href="http://www.vertigrated.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vertigrated.com/blog</link>
	<description>practical professional programming</description>
	<lastBuildDate>Mon, 22 Aug 2011 15:40:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Enforcing Fluent API adherence using Interfaces in Java</title>
		<link>http://www.vertigrated.com/blog/2011/07/enforcing-fluent-api-adherence-using-interfaces-in-java/</link>
		<comments>http://www.vertigrated.com/blog/2011/07/enforcing-fluent-api-adherence-using-interfaces-in-java/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 19:48:05 +0000</pubDate>
		<dc:creator>Jarrod Roberson</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Theory]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[fluent]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.vertigrated.com/blog/?p=663</guid>
		<description><![CDATA[This some considerable noise on the internet about Fluent APIs and using them. There was a question on stackoverflow.com about how to enforce calling all the required methods to guarantee you fully materialize an object when using a Builder Pattern with a Fluent API approach. The appropriate way to achieve this is through Interfaces that <a href='http://www.vertigrated.com/blog/2011/07/enforcing-fluent-api-adherence-using-interfaces-in-java/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>This some considerable noise on the internet about Fluent APIs and using them. There was a <a href="http://stackoverflow.com/questions/6613429">question on stackoverflow.com</a> about how to enforce calling all the required methods to guarantee you fully materialize an object when using a Builder Pattern with a Fluent API approach.</p>
<p>The appropriate way to achieve this is through Interfaces that represent each of the steps in the procedure. You have to make the constructor to resulting object that implements these interfaces private so that no one can directly create the object, and you probably want to make the class private as well so no one can cast directly to the resulting object from a reference to one of the intermediate Interfaces.</p>
<p>Here is the code for one example on how to have a Fluent API that enforces the order in which the methods are called and protects the object being built.</p>
<p><script src="https://gist.github.com/1070367.js?file=FluentApiEnforcement.java"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vertigrated.com/blog/2011/07/enforcing-fluent-api-adherence-using-interfaces-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The final word on final</title>
		<link>http://www.vertigrated.com/blog/2011/05/the-final-word-on-final/</link>
		<comments>http://www.vertigrated.com/blog/2011/05/the-final-word-on-final/#comments</comments>
		<pubDate>Mon, 09 May 2011 17:34:49 +0000</pubDate>
		<dc:creator>Jarrod Roberson</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Theory]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[final]]></category>
		<category><![CDATA[idiom]]></category>
		<category><![CDATA[keyword]]></category>

		<guid isPermaLink="false">http://www.vertigrated.com/blog/?p=616</guid>
		<description><![CDATA[Where is final used? There are a lot of Java developers that don&#8217;t understand the keyword final. The keyword final is one of your greatest allies in writing bug free maintainable code. It makes reading code much more deterministic and step debugging a breeze. And it makes your code side effect free. Side effects are <a href='http://www.vertigrated.com/blog/2011/05/the-final-word-on-final/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<h2>Where is final used?</h2>
<p>There are a lot of Java developers that don&#8217;t understand the keyword <code>final</code>. The keyword <code>final</code> is one of your greatest allies in writing bug free maintainable code. It makes reading code much more deterministic and step debugging a breeze. And it makes your code <strong>side effect free</strong>. </p>
<p>Side effects are on of the most common causes of bugs and instability in imperative programming, and one of the most difficult to discover and correct.</p>
<p>One reason most people don&#8217;t understand why <code>final</code> is such a powerful keyword, is that it has two distinct meanings and most people only really understand the first.</p>
<h3>Marking a class as final</h3>
<p>The most popular understanding of why to use the keyword <code>final</code> is in marking a <code>class</code> as <code>final</code>. This makes sure that no one can sub-class the class that is marked <code>final</code>. This is like putting a sub class lock on your code, it means that the original developer intends that this behavior should never change.</p>
<h3>Marking a method as final</h3>
<p>Another similar use to the <code>class</code> usage, but much less known, is to mark a <code>method</code> as <code>final</code>. This is a seen in much rarer cases than marking an entire <code>class</code> as <code>final</code>. It locks the <code>method</code> so that sub classes can&#8217;t <code>override</code> the behavior of the <code>method</code> and shows the intent of the original developer that this should never change.</p>
<h3>Marking a variable reference as final</h3>
<p>The second most popular understanding of why to use the keyword <code>final</code> is to mark variables as <code>final</code>, this one is also <strong>the most misunderstood. This does something completely different than its use as a <code>class</code> or <code>method</code> modifier. It shows the intention of the original developer that the </strong><strong>reference</strong> to an object or primitive should be <strong>immutable</strong> and trying to change it should result in an error.</p>
<h2>final vs immutable</h2>
<p>Some clarification is in order here, because there seems to be a lot of confusion about <strong>what</strong> is actually <strong>immutable</strong> when a variable reference is marked <code>final</code>.</p>
<blockquote><p>It is the variable <strong>reference</strong> that is immutable, <strong>not</strong> the Object itself.</p></blockquote>
<p>When someone refers to an Object as immutable, such as</p>
<blockquote><p>The <code>String</code> object is immutable</p></blockquote>
<p>they mean the internal state of the <code>String</code> object can never change, this is completely different than</p>
<blockquote><p>the variable <code>X</code> is marked <code>final</code> and thus immutable.</p></blockquote>
<p>Marking a variable <code>final</code> doesn&#8217;t magically make the Object instance that it is refering to immutable.</p>
<p>Lets take the following example:</p>
<p><code>private final List people = new ArrayList();</code></p>
<p>What this states is that the <strong>reference</strong> <code>people</code> can <strong>not</strong> be changed to point to a different instance of <code>List</code>.</p>
<p>It does <strong>not</strong> modify the behavior of the <code>ArrayList</code> implemenation in any way. The instance of the <code>ArrayList</code> can still be modifed. <code>Person</code> objects can be added and removed which mutates the <code>ArrayList</code> as it normally would.</p>
<p>What the <code>final</code> keyword does here is shows the intention of the original developer, that what the <code>people</code> variable refers to should never change.</p>
<p>If you later executed these instructions your code would not compile.</p>
<p><code>this.people = new ArrayList();</code></p>
<h2>When should I use the keyword final?</h2>
<p>Best practices show that you should use the keyword <code>final</code> as liberally as possible. The restrictions that <code>final</code> puts on what it is modifying <strong>always</strong> makes code easier to understand the intentions of the original developer and makes understanding the logic easier and makes step debugging easier as well.</p>
<p>Since marking a <code>class</code> or <code>method</code> as <code>final</code> is pretty explanatory and you can reason fairly easily why this is done and what its benefits are I am going to discuss why you should always strive to mark as many variable references <code>final</code> as possible.</p>
<h2>The first two rules are fairly easy to implement, and show the most benefit when used</h2>
<h3>Always mark arguments to constructors and methods as final</h3>
<p><code>public class Person(final String firstName, final String lastName)</code></p>
<p><code>public int getNextDay(final Date date)</code></p>
<blockquote><p>This is a very powerful tool to help create easy to understand, and maintainable code, it shows to everyone that the arguments to <strong>never</strong> change. If they never change, as you read through the code to understand it you can be guaranteed that the argument values are consistent everywhere they are reference, they always referent to the same values that were passed in.</p></blockquote>
<h3>Always mark local variable final</h3>
<p>One of the hardest things to debug is some long method that re-assigns a value over and over again in many different decision making constructs. Nested <code>if/elseif/else</code> statements and <code>try/catch/finally</code> blocks that re-use and mutate a local variable make it very difficult to statically reason what the expected behavior of the code is. It makes the method one big ad-hoc state machine. And the only way to understand the behavior is to step debug through the code, or worse pepper it with <code>print</code> statements all through it in an attempt to trace what the behavior is depending on the inputs.</p>
<p>It also makes it very easy for someone to come along behind you and break something un-intentionally because they have re-assigned something and broken your ad-hoc state machine.</p>
<p>Functional languages like Erlang have single assignment variables as a core part of their paradigm, and they tend to be more deterministic, easier to read and reason about what the intention of the logic is and less buggy because there is never a huge ad-hoc state machine.</p>
<h3>Marking all instance variable references final</h3>
<p>This one is harder to stick to consistently from a conceptual stand point. Mainly because it goes against everything most Java developers have ever know. But the rewards for learning to apply this practice are tremendous.</p>
<p>The first benefit is you get all the same benefits as marking arguments and local variables as <code>final</code>. You get easier to read and understand the intention of the original developer, you get simpler debugging and <strong>no side effects</strong>.</p>
<p>The second benefit of marking all instance variables as <code>final</code> is that you gain thread safety immediately, when all instance variables are <code>final</code> it makes the instance of the class <strong>immutable</strong>. Immutable instances can be shared without any locking semantics among as many threads as you wish since there is never the chance of data changing, so that means no contention and no race conditions.</p>
<p>Dealing with immutable data might seem like a hassle, but as soon as you start working with the data structures concurrently, dealing with immutable data structures is simple compared to dealing with concurrency primitives, locks, semaphores, synchronized blocks, counters and all the other baggage and boilerplate overhead that comes with concurrency in Java. All that concurrency overhead is extra code to be tested, debugged and maintained.</p>
<h2>There is a performance angle as well</h2>
<p>In previous versions of the JVM marking any variable references, instance, local and arguments as <code>final</code> allowed the compiler to do some advanced optimizations through caching because it could be sure that the contents of the variable reference never changed. This combined with immutable objects made a significant difference in concurrent code execution. In the case of <code>final String</code> declarations the compiler can aggressively optimize those out to almost nothing, since <code>final String</code> declarations are considered <strong>string literals</strong> if you concatenate string literals with <code>+</code> it can just convert them all to one single string literal.</p>
<p>Some of the performance aspects of the <code>final</code> keyword from previous compilers are handled with the most current JIT, but using <code>final</code> just for performance isn&#8217;t what this article is about, it is about increasing the quality of your code base, making your logic easier to discern the intention of the developer and making it more maintainable over the long run. Performance enhancements are just a bonus to these practices.</p>
<h2>So the final word on final is</h2>
<p>Try to apply the <code>final</code> modifier everywhere you can to make as many variables as possible single assignment, the more you do it the more you will appreciate the entire class of bugs and logic complications it allows you to eliminate through the single assignment variable idiom.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vertigrated.com/blog/2011/05/the-final-word-on-final/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Certifications Huh, What are they good for Absolutely Nothing!</title>
		<link>http://www.vertigrated.com/blog/2011/05/certifications-what-are-they-good-for/</link>
		<comments>http://www.vertigrated.com/blog/2011/05/certifications-what-are-they-good-for/#comments</comments>
		<pubDate>Wed, 04 May 2011 23:21:19 +0000</pubDate>
		<dc:creator>Jarrod Roberson</dc:creator>
				<category><![CDATA[career]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Techonology]]></category>
		<category><![CDATA[advice]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.vertigrated.com/blog/?p=601</guid>
		<description><![CDATA[Certifications show you can study and take a test They don&#8217;t demonstrate that you actually comprehend any thing that was on the test. In the worse case certifications can turn off a lot of hiring managers as they got burned in the dotCom bubble boom with unqualified staff but were &#8220;certified&#8221;, it looks like someone <a href='http://www.vertigrated.com/blog/2011/05/certifications-what-are-they-good-for/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><strong>Certifications show you can study and take a test</strong></p>
<p>They don&#8217;t <strong>demonstrate </strong>that you actually comprehend any thing that was on the test. In the worse case certifications can turn off a lot of hiring managers as they got burned in the dotCom bubble boom with unqualified staff but were &#8220;certified&#8221;, it looks like someone trying to take a short cut to actual knowledge and experience that they can&#8217;t <strong>demonstrate</strong>.</p>
<p>I think twice about people with lots of certifications, especially in things they have little or no <strong>demonstrable</strong> experience in. I had so many real estate agents in the 1990&#8242;s applying for developer positions with a arms length of certifications and bogus years of experience it was sickening. Lots of my peers experienced the same thing.</p>
<p><strong>Look at it this way</strong></p>
<p>Which would you hire? A graphic designer with a bunch of Photoshop certifications or one with a portfolio of <strong>demonstrable</strong> work using Photoshop, given that they claimed the same number of years of experience?</p>
<p><strong>Certifications don&#8217;t make you more marketable</strong></p>
<p>Better marketing makes you more marketable. You should invest in learning how to sell yourself on what you know and learn how to <strong>demonstrate</strong>what you know, don&#8217;t spend money on taking tests about things you partially know in an attempt to prove something to someone.</p>
<p><strong>Demonstrable knowledge isn&#8217;t about years of experience, it is about demonstration</strong></p>
<p>Spend some time writing an open source application, no matter how trival, that <strong>demonstrates </strong>your knowledge, put it on GitHub, put it on FreshMeat.net, put links to those sites on your resume.</p>
<p>Spend time writing about development on a blog, people with experience have personal opinions about what they do. Blog about your open source development and your opinions about .Net and its libraries. Opinions, even ones I don&#8217;t agree with <strong>demonstrate </strong>your knowledge about something.</p>
<p>I know this will sound silly, but your job isn&#8217;t what you do, it is selling yourself. You need to be able communicate that as quickly and clearly as possible. Marketing and Sales is all about communication. <strong>Demonstrating </strong>something is the most effective form of communication.</p>
<p><strong>Generalists usually make more valuable employees</strong></p>
<p>Generalist usually make better employees since they have a broader range of experience to draw from. Later on in your career when you get totally burned out on programming, you will want to be able move into some position where you lead teams and then eventually move on into management. Generalists can mentor and manager a broader range of talent and demonstrate more flexibility.</p>
<p><strong>In golf you need to know how to use every club, only knowing the putter won&#8217;t get you far on a full size golf course.</strong></p>
<p>Being a .Net guru won&#8217;t get you a management position, it will get you a glass ceiling of Senior .Net Developer. Being able to <strong>demonstrate </strong>a broad range of expertise will get you farther toward management than being a .Net guru. And it will open more doors outside the .Net world.</p>
<p><strong>Success != scoring good on tests</strong></p>
<p>Think about it, nobody in the software development field that is a big name got there because of some test they took. They all built something or wrote something that <strong>demonstrated </strong>that they knew what they were doing. Mark Zuckerberg didn&#8217;t get where he is by taking tests or years of experience, he <strong>demonstrated</strong> to venture capitalist what he could do by just going and building FaceBook. He didn&#8217;t try and convince them to give him money for something he was <strong>going</strong> to do, he did it, and they came to him. He <strong>demonstrated</strong> he could deliver and they believed he could continue to deliver.</p>
<p><strong>Years experience != proficiency</strong></p>
<p>I have worked with many developers that claimed 10+ years of experience in Java. 9 out of 10 of them wrote code like it was 10 years ago. They had 10 years of doing the same thing they did the first year. 10 years of 1 year of experience isn&#8217;t valuable to me.</p>
<p>The 1 out of the 9 could easily <strong>demonstrate </strong>their proficiency either with examples or their opinions about current modern Java. The others were still using <code>Enumeration</code>, <code>Vector </code>and <code>Hashmap </code>in 2009 and didn&#8217;t even know or care about Generics or the Collections API, this was a <strong>negative</strong> demonstration of their experience.</p>
<p><strong>On a Personal Note</strong></p>
<p>If you want to go and take certifications for yourself, to see what the testing organization thinks is important or valuable then there may be some value to it for you personally. It might show you where the holes in your knowledge of a particular technology is and give some direction of knowing what you don&#8217;t know you don&#8217;t know. But to most hiring managers they are not a decision maker.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vertigrated.com/blog/2011/05/certifications-what-are-they-good-for/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Releasing Maven Artifacts to Central Repository through Sonatype</title>
		<link>http://www.vertigrated.com/blog/2011/03/releasing-maven-artifacts-to-central-repository-through-sonatype/</link>
		<comments>http://www.vertigrated.com/blog/2011/03/releasing-maven-artifacts-to-central-repository-through-sonatype/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 16:43:35 +0000</pubDate>
		<dc:creator>Jarrod Roberson</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Unix / Linux]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[gpg]]></category>
		<category><![CDATA[maven3]]></category>
		<category><![CDATA[sonatype]]></category>

		<guid isPermaLink="false">http://www.vertigrated.com/blog/?p=597</guid>
		<description><![CDATA[I have released my first Maven artifacts to the Central Repository through Sonatype&#8217;s Open Source Nexus Server. You have to jump through some hoops to get everything just right to be able to release to the Sonatype Nexus repository, and I could not find all the information I needed in one place so I will <a href='http://www.vertigrated.com/blog/2011/03/releasing-maven-artifacts-to-central-repository-through-sonatype/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I have released my first Maven artifacts to the Central Repository through Sonatype&#8217;s Open Source <a href="https://oss.sonatype.org/">Nexus Server</a>.</p>
<p>You have to jump through some hoops to get everything just right to be able to release to the Sonatype Nexus repository, and I could not find all the information I needed in one place so I will document what I had trouble with here.</p>
<p>I followed these <a href="https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide">instructions</a> and I had no trouble on Linux or OSX with getting anything to work, Windows 7 was a different story.</p>
<p>First thing I had trouble with on Windows 7 was getting GPG setup to sign my artifacts. I am using the GitBash shell that comes with the Git distribution for Windows. It doesn&#8217;t have everything you need to work with gpg as per the  Sonatype Blog <a href="http://www.sonatype.com/people/2010/01/how-to-generate-pgp-signatures-with-maven/">instructions</a>. What I had to do was download the <a href="ftp://ftp.gnupg.org/gcrypt/binary/gnupg-w32cli-1.4.11.exe">Windows installer</a> for GPG from <a href="http://www.gnupg.org/download/#auto-ref-0">GnuPG.org</a></p>
<p>Then I copied all the <code>.exe</code> and <code>iconv.dll</code> files from <code>C:\Program Files (x86)\GNU\GnuPG</code> into <code>C:\Program Files (x86)\Git\bin</code>. These were the default installation locations for each of these packages, your locations may differ if you put them somewhere else.</p>
<p>The one other thing is I had a hard time getting the gpg goal to fire and sign all my artifacts when using the <code>maven-release-plugin</code>. I ended up with the following command line that did the trick.</p>
<p><code>mvn clean package verify release:preform -Darguments=-Dgpg.passphrase=PASSPHRASE</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vertigrated.com/blog/2011/03/releasing-maven-artifacts-to-central-repository-through-sonatype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to combine GWT and Jasper Reports using Maven</title>
		<link>http://www.vertigrated.com/blog/2011/03/how-to-combine-gwt-and-jasper-reports-using-maven/</link>
		<comments>http://www.vertigrated.com/blog/2011/03/how-to-combine-gwt-and-jasper-reports-using-maven/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 18:28:57 +0000</pubDate>
		<dc:creator>Jarrod Roberson</dc:creator>
				<category><![CDATA[GWT]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[gwt]]></category>
		<category><![CDATA[jasper]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[reports]]></category>

		<guid isPermaLink="false">http://www.vertigrated.com/blog/?p=584</guid>
		<description><![CDATA[Make your pom.xml dependency entry for Jasper Reports look like this If you don&#8217;t use the excludes directive you get the java.lang.NoSuchFieldError: reportUnusedDeclaredThrownExceptionIncludeDocCommentReference error. &#60;dependency&#62; &#160;&#160;&#160;&#160;&#60;groupId&#62;net.sf.jasperreports&#60;/groupId&#62; &#160;&#160;&#160;&#160;&#60;artifactId&#62;jasperreports&#60;/artifactId&#62; &#160;&#160;&#160;&#160;&#60;version&#62;3.7.4&#60;/version&#62; &#160;&#160;&#160;&#160;&#60;exclusions&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;exclusion&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;artifactId&#62;jdtcore&#60;/artifactId&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;groupId&#62;eclipse&#60;/groupId&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;/exclusion&#62; &#160;&#160;&#160;&#160;&#60;/exclusions&#62; &#60;/dependency&#62;]]></description>
			<content:encoded><![CDATA[<p>Make your <code>pom.xml</code> dependency entry for Jasper Reports look like this<br />
If you don&#8217;t use the <code>excludes</code> directive you get the <code>java.lang.NoSuchFieldError: reportUnusedDeclaredThrownExceptionIncludeDocCommentReference</code> error.</p>
<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:inconsolata, monospace; "><span style="color:#881280;">&lt;dependency&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;groupId&gt;</span>net.sf.jasperreports<span style="color:#881280;">&lt;/groupId&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;artifactId&gt;</span>jasperreports<span style="color:#881280;">&lt;/artifactId&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;version&gt;</span>3.7.4<span style="color:#881280;">&lt;/version&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;exclusions&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><span style="color:#881280;">&lt;exclusion&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;artifactId&gt;</span>jdtcore<span style="color:#881280;">&lt;/artifactId&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;groupId&gt;</span>eclipse<span style="color:#881280;">&lt;/groupId&gt;</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;/exclusion&gt;</span></b><br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881280;">&lt;/exclusions&gt;</span><br />
<span style="color:#881280;">&lt;/dependency&gt;</span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.vertigrated.com/blog/2011/03/how-to-combine-gwt-and-jasper-reports-using-maven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interface and Class Naming Anti-Patterns &#8211; Java Naming Convention Tautologies</title>
		<link>http://www.vertigrated.com/blog/2011/02/interface-and-class-naming-anti-patterns-java-naming-convention-tautologies/</link>
		<comments>http://www.vertigrated.com/blog/2011/02/interface-and-class-naming-anti-patterns-java-naming-convention-tautologies/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 18:12:24 +0000</pubDate>
		<dc:creator>Jarrod Roberson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.vertigrated.com/blog/?p=565</guid>
		<description><![CDATA[Name your Interface what it is If your interface is a Truck, call it Truck. Not ITruck because it isn&#8217;t an ITruck it is a Truck. An Interface in Java is a Type. Then you have implementations of DumpTruck, TransferTruck, WreckerTruck, CementTruck, etc. When you are using the Interface Truck in place of a sub-class <a href='http://www.vertigrated.com/blog/2011/02/interface-and-class-naming-anti-patterns-java-naming-convention-tautologies/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<h2>Name your Interface what it is</h2>
<p>If your interface is a <code>Truck</code>, call it <code>Truck</code>. Not <code>ITruck</code> because it isn&#8217;t an <code>ITruck</code> it is a <code>Truck</code>. An Interface in Java is a <strong>Type</strong>. Then you have implementations of <code>DumpTruck</code>, <code>TransferTruck</code>, <code>WreckerTruck</code>, <code>CementTruck</code>, etc. When you are using the Interface <code>Truck</code> in place of a sub-class you just cast it to <code>Truck</code>. As in <code>List&lt;Truck&gt;</code>. Putting <code>I</code> in front is just crappy Hungarian style notation tautology that adds nothing but more stuff to type to your code.</p>
<p>All modern Java IDEs mark Interfaces and Implementations and what not without this silly notation. Don&#8217;t call it <code>TruckClass</code> that is tautology just as bad as the <code>IInterface </code>tautology.</p>
<p>The only real exception to this rule that I accept, and there are always exceptions is <code>AbstractTruck</code> when the class is package local. Since only the sub-classes will every see this and you should never cast to an Abstract class it does add some information that the class is abstract and to how it should be used. You could still come up with a better name than <code>AbstractTruck </code>and use <code>BaseTruck</code> or <code>DefaultTruck</code> or some other more descriptive name instead. But since Abstract classes should never be part of any public facing interface it is an acceptable exception to the rule.</p>
<h2>If it is an class it is an implementation</h2>
<p>And the <code>Impl</code> suffix is just more noise as well. More tautology. Anything that isn&#8217;t an Interface is an Implementation, even Abstract classes which are just partial implementations. Are you going to put that silly <code>Impl</code> suffix on every name of every Class? It makes no more sense than suffixing every Class with <code>Class</code>.</p>
<p>The Interface is a contract on what the public methods and properties have to support, it is also <code>Type</code> information as well. Everything that implements <code>Truck</code> is a <code>Type</code> of <code>Truck</code>.</p>
<p>Look to the Java standard library itself. Do you see IList, ArrayListImpl, LinkedListImpl? No you see. List and ArrayList and LinkedList. Any of these silly prefix/suffix naming conventions all violate the <a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself">DRY</a> principal as well.</p>
<p>Also if you find yourself adding <code>DTO</code>, <code>JDO</code>, <code>BEAN</code> or other silly repetitive prefixes or suffixes to object names then they probably belong in a package instead of all those suffixes. Properly packaged namespaces are self documenting and reduce all the useless redundant information in these really poorly conceived proprietary naming schemes that most places don&#8217;t even adhere to in a consistent manner. If all you can come up with to make your Class name unique is suffixing it with <code>Impl</code>, then you need to rethink having an Interface at all. So when you have an situation where you have an Interface and a single Implementation that is not uniquely specialized from the Interface you probably don&#8217;t need the Interface.</p>
<p>If you can&#8217;t give unique descriptive names to your Interfaces and Classes, you are doing it wrong.</p>
<h2>Mocking the Mocking Argument</h2>
<p>It has been argued that putting a <code>Mock</code> prefix or suffix on classes is a good idiom to mark the classes as Mock implementations, why not call them <code>MockImpl</code> if you are going to argue that?<br />
Assuming that the real classes are in <code>com.company.app.service</code>. Mock implementations should be in their own <code>com.company.app.service.mock</code> package, ideally in a different directory structure with the <code>Test</code> classes, as in Maven, which will allow them to have the same names as the non-Mock classes, and still document that they are Mocks for testing only, and not pollute the name space of the production code and make it easy to not-include that code in the deployment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vertigrated.com/blog/2011/02/interface-and-class-naming-anti-patterns-java-naming-convention-tautologies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSAP Command Line Application Maven Archetype</title>
		<link>http://www.vertigrated.com/blog/2011/02/jsap-cli-app-maven-archetype/</link>
		<comments>http://www.vertigrated.com/blog/2011/02/jsap-cli-app-maven-archetype/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 07:31:53 +0000</pubDate>
		<dc:creator>Jarrod Roberson</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[archetype]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[jsap]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://www.vertigrated.com/blog/?p=559</guid>
		<description><![CDATA[I have created my first Maven 2 / 3 Archetype for generating command line applications that are powered by Java Simple Argument Parser ( JSAP ). Its source code lives on GitHub. I am working on getting it posted to Sonatype and synced to Central Repository.]]></description>
			<content:encoded><![CDATA[<p>I have created my first Maven 2 / 3 Archetype for generating command line applications that are powered by Java Simple Argument Parser ( JSAP ). Its source code lives on <a href="http://github.com/fuzzylollipop/jsap-cli-archetype">GitHub</a>. I am working on getting it posted to Sonatype and synced to Central Repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vertigrated.com/blog/2011/02/jsap-cli-app-maven-archetype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Generic Object Oriented replacement for large Switch / Case and If / Else statements in Java</title>
		<link>http://www.vertigrated.com/blog/2011/02/a-generic-object-oriented-replacement-for-large-switch-case-and-if-else-statements-in-java/</link>
		<comments>http://www.vertigrated.com/blog/2011/02/a-generic-object-oriented-replacement-for-large-switch-case-and-if-else-statements-in-java/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 04:12:25 +0000</pubDate>
		<dc:creator>Jarrod Roberson</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Theory]]></category>
		<category><![CDATA[chain of responsiblity]]></category>
		<category><![CDATA[generics]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[patterns]]></category>

		<guid isPermaLink="false">http://www.vertigrated.com/blog/?p=554</guid>
		<description><![CDATA[I saw this post on StackOverflow and thought I would whip up a quick Object Oriented solution using Generics using the Chain of Responsibility Pattern. This was a quick exercise to see how it might look. There are many other ways that this could be implemented, like using Dependency Injection to supply the implementations of <a href='http://www.vertigrated.com/blog/2011/02/a-generic-object-oriented-replacement-for-large-switch-case-and-if-else-statements-in-java/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I saw this post on <a href="http://stackoverflow.com/questions/5086322/java-switch-statement-multiple-cases">StackOverflow</a> and thought I would whip up a quick Object Oriented solution using Generics using the Chain of Responsibility Pattern. This was a quick exercise to see how it might look. There are many other ways that this could be implemented, like using Dependency Injection to supply the implementations of the <code>Case.of()</code> method, that would add another layer of abstraction, and complexity, but might make it less verbose.</p>
<p><script src="https://gist.github.com/839992.js?file=Switch.java"></script></p>
<p>Here is what the expected outcome should be.</p>
<p><code><br />
// integerSwitch<br />
Case 1, break = true<br />
// rangeSwitch<br />
Case 10 is between 5 and 100, break = true<br />
// rangeCase added to integerSwitch<br />
Case 1, break = true<br />
Case 10 is between 5 and 100, break = true<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vertigrated.com/blog/2011/02/a-generic-object-oriented-replacement-for-large-switch-case-and-if-else-statements-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reading data from a file on the classpath in Java</title>
		<link>http://www.vertigrated.com/blog/2011/02/reading-data-from-a-file-on-the-classpath-in-java/</link>
		<comments>http://www.vertigrated.com/blog/2011/02/reading-data-from-a-file-on-the-classpath-in-java/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 23:08:23 +0000</pubDate>
		<dc:creator>Jarrod Roberson</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[classpath]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[resource]]></category>

		<guid isPermaLink="false">http://www.vertigrated.com/blog/?p=547</guid>
		<description><![CDATA[Sometimes you want to load data at runtime from inside a .jar file or .war file to populate at List or Map or something. Here is how to do that easily. Just make sure that your data file is in the same package along side the Class that is loading it, or refer to it <a href='http://www.vertigrated.com/blog/2011/02/reading-data-from-a-file-on-the-classpath-in-java/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Sometimes you want to load data at runtime from inside a .jar file or .war file to populate at List or Map or something.<br />
Here is how to do that easily. Just make sure that your data file is in the same package along side the Class that is loading it, or refer to it using an absolute package path.</p>
<p><script src="https://gist.github.com/839627.js?file=ReadFromClasspathResource.java"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vertigrated.com/blog/2011/02/reading-data-from-a-file-on-the-classpath-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working Maven 3 Google App Engine Plugin with GWT support.</title>
		<link>http://www.vertigrated.com/blog/2011/02/working-maven-3-google-app-engine-plugin-with-gwt-support/</link>
		<comments>http://www.vertigrated.com/blog/2011/02/working-maven-3-google-app-engine-plugin-with-gwt-support/#comments</comments>
		<pubDate>Sun, 06 Feb 2011 18:00:45 +0000</pubDate>
		<dc:creator>Jarrod Roberson</dc:creator>
				<category><![CDATA[GAE]]></category>
		<category><![CDATA[GWT]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[gae]]></category>
		<category><![CDATA[gwt]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[maven2]]></category>
		<category><![CDATA[maven3]]></category>

		<guid isPermaLink="false">http://www.vertigrated.com/blog/?p=526</guid>
		<description><![CDATA[I spent a great deal of time getting this to work. I could not find a single source of information on what all the needed dependencies and repositories were, so there was a lot of trial and error involved. This first version is configured for GAE 1.4.0 and GWT 2.1.1, the latest versions at the <a href='http://www.vertigrated.com/blog/2011/02/working-maven-3-google-app-engine-plugin-with-gwt-support/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I spent a great deal of time getting this to work. I could not find a single source of information on what all the needed dependencies and repositories were, so there was a lot of trial and error involved. This first version is configured for GAE 1.4.0 and GWT 2.1.1, the latest versions at the time of this writing. As these libraries advance I will update the <code>pom.xml</code> with the changes. Even though the title says, Maven 3 it should work just fine with Maven 2 as well. It uses <a href="http://code.google.com/p/maven-gae-plugin/">maven-gae-plugin</a> version 0.8.1.</p>
<p>First off is the entire working gae-gwt archetype sample project on <a href="https://github.com/fuzzylollipop/Maven-3-GAE-GWT">GitHub</a>. This project cleanly compiles, enhances for JDO and deploys to GAE. </p>
<p>First thing you need to do to use this starter project is to edit the <code>~/.m2/settings.xml</code> to point to the home directory for the Google App Engine 1.4.0 SDK. This is required because on Windows 7 I could not get the <code>gae:unpack</code> goal to work, it works fine without this entry on my Centos 5.5 and OSX machine, so you have to put a reference to the GAE SDK home directory, this is the most platform neutral way to do it. <em>Skip this step if you can get the</em> <code>gae:unpack</code> <em>command to work</em>.</p>
<p>So get the starter <a href="https://download.github.com/fuzzylollipop-Maven-3-GAE-GWT-6aa8e46.tar.gz">project</a>, change the name of the directory, change the <code>${group.id}</code> and <code>${app.name}</code> in the <code>pom.xml</code> and you should have a good starting point to do GAE development with GWT. Don&#8217;t forget to update the GWT application file at <code>src\main\webapp\WEB-INF\appengine-web.xml</code>.</p>
<p>Now here are the details of what makes this work.</p>
<p>Here is what the <code>settings.xml</code> file should look like.</p>
<p><script src="https://gist.github.com/813517.js?file=settings.xml"></script></p>
<p>then you can compile and deploy the project with the following command.</p>
<p><code>$> mvn clean package gae:deploy</code></p>
<p>Here is what the <code>pom.xml</code> looks like for GAE 1.4.0 and GWT 2.1.1 as of this post.</p>
<p><script src="https://gist.github.com/813517.js?file=pom.xml"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vertigrated.com/blog/2011/02/working-maven-3-google-app-engine-plugin-with-gwt-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

