<?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>Mind Dump</title>
	<atom:link href="http://lostechies.com/ryansvihla/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/ryansvihla</link>
	<description>The small minded meanderings of the confused</description>
	<lastBuildDate>Sun, 25 Sep 2011 18:41:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Rail 3.1 CI setup with Jenkins, Test Unit &amp; SimpleCov on OS X Lion.</title>
		<link>http://lostechies.com/ryansvihla/2011/09/25/rail-3-1-ci-setup-with-jenkins-test-unit-simplecov-on-os-x-lion/</link>
		<comments>http://lostechies.com/ryansvihla/2011/09/25/rail-3-1-ci-setup-with-jenkins-test-unit-simplecov-on-os-x-lion/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 17:04:54 +0000</pubDate>
		<dc:creator>Ryan Svihla</dc:creator>
				<category><![CDATA[CI]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://lostechies.com/ryansvihla/?p=53</guid>
		<description><![CDATA[I recently had to setup a build server for some rails work I&#8217;m doing. Still wanting to support my other projects I setup Jenkins. I ran into several issues. Running Jenkins as a hidden user First I noticed that jenkins&#160;&#8230; <a href="http://lostechies.com/ryansvihla/2011/09/25/rail-3-1-ci-setup-with-jenkins-test-unit-simplecov-on-os-x-lion/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently had to setup a build server for some rails work I&#8217;m doing. Still wanting to support my other projects I setup Jenkins. I ran into several issues.</p>
<h2>Running Jenkins as a hidden user</h2>
<p>First I noticed that jenkins was running as the &#8220;daemon&#8221; user, this obviously wasn&#8217;t going to work for github and rvm needs. So I did some googling and had some guides to get Jenkins running as a specific user. I did the following (sourced from http://colonelpanic.net/2011/06/jenkins-on-mac-os-x-git-w-ssh-public-key/ ).</p>
<pre>sudo dscl . create /Users/jenkins
sudo dscl . create /Users/jenkins PrimaryGroupID 1
sudo dscl . create /Users/jenkins UniqueID 300
sudo dscl . create /Users/jenkins UserShell /bin/bash
sudo dscl . passwd /Users/jenkins $PASSWORD
sudo dscl . create /Users/jenkins home /Users/Shared/Jenkins/Home/</pre>
<p>Note: That&#8217;s really $PASSWORD up above. This gives you a prompt to enter that password. Next you&#8217;ll need to stop the Jenkins service and edit the plist and start the service back up.</p>
<pre>sudo launchctl unload -w /Library/LaunchDaemons/org.jenkins-ci.plist
sudo vim /Library/LaunchDaemons/org.jenkins-ci.plist
sudo launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist</pre>
<p>&nbsp;</p>
<p>You&#8217;re plist file should end up like this.</p>
<p><img title="file_to_edit.png" src="http://lostechies.com/ryansvihla/files/2011/09/file_to_edit.png" border="0" alt="File to edit" width="600" height="355" /></p>
<h2>RVM issues</h2>
<p>Now my next issue was despite what I&#8217;d read elsewhere I was unable to get Jenkins to use the default ruby provided by RVM. So I just pasted the commands that I would run anyway in the &#8220;Execute Shell&#8221; build step.</p>
<p><img title="rvm_workaround.png" src="http://lostechies.com/ryansvihla/files/2011/09/rvm_workaround.png" border="0" alt="Rvm workaround" width="600" height="161" /></p>
<h2>Getting Jenkins to see tests</h2>
<p>I&#8217;ve been using Test:Unit/Minitest lately just to keep more consistent with my day to day work. However I haven&#8217;t found a way to get my tests to show when using the &#8220;Execute Shell&#8221; task. I found a little gem called ci_reporter that exports to the standard junit format, unfortunately it doesn&#8217;t work with minitest yet. That&#8217;s ok I haven&#8217;t done anything that Test:Unit doesn&#8217;t support so far so I added the the following to my Gemfile (note the part about unit-test 2.0):</p>
<pre>group :development, :test do
  gem 'ci_reporter', '1.6.3'
  gem 'test-unit', '~&gt; 2.0.0'
  # Pretty printed test output
  gem 'turn', :require =&gt; false
end</pre>
<p>Running &#8220;rake ci:setup:testunit test&#8221; should give you a bunch of xml files in tests/reports. Now we need to tell Jenkins where to find those reports so add a post build action to pick them up as junit reports.</p>
<p><img title="post_build_actions.png" src="http://lostechies.com/ryansvihla/files/2011/09/post_build_actions.png" border="0" alt="Post build actions" width="600" height="82" /></p>
<h2>Rcov reports</h2>
<p>This was pretty easy.</p>
<ol>
<li>Install Jenkins plugin for RCov (it&#8217;s in the plugin list in the admin section).</li>
<li>add simplecov and semiplecov-rcov to your Gemfile.</li>
<li>add the following 4 lines to the TOP of your tests/test_helper.rb file:</li>
</ol>
<pre brush="ruby">
require 'simplecov'
require 'simplecov-rcov'
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
SimpleCov.start 'rails'
</pre>
<p><br/></p>
<h2>In closing</h2>
<p>This took a fair amount of time, but the end result was quite satisfying. I now have CI with tests, tests coverage, RVM to target different versions of Ruby and bundler to make sure my Gem environment is sane.</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/ryansvihla/2011/09/25/rail-3-1-ci-setup-with-jenkins-test-unit-simplecov-on-os-x-lion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The difficult definition of professional software development</title>
		<link>http://lostechies.com/ryansvihla/2011/02/04/the-difficult-definition-of-professional-software-development/</link>
		<comments>http://lostechies.com/ryansvihla/2011/02/04/the-difficult-definition-of-professional-software-development/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 22:51:00 +0000</pubDate>
		<dc:creator>Ryan Svihla</dc:creator>
				<category><![CDATA[Craftsmanship]]></category>

		<guid isPermaLink="false">/blogs/rssvihla/archive/2011/02/04/the-difficult-definition-of-professional-software-development.aspx</guid>
		<description><![CDATA[Here are some of the contradictory phrases (and a few paraphrases) I&#8217;ve overheard used to define what is &#8220;good&#8221; and &#8220;bad&#8221; code. Code should always be well commented Maintainable code has unit tests and well named methods therefore needs little&#160;&#8230; <a href="http://lostechies.com/ryansvihla/2011/02/04/the-difficult-definition-of-professional-software-development/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here are some of the contradictory phrases (and a few paraphrases) I&#8217;ve overheard used to define what is &#8220;good&#8221; and &#8220;bad&#8221; code. </p>
<ul>
<li>Code should always be well commented</li>
<li>Maintainable code has unit tests and well named methods therefore needs little if any comments</li>
<li>Class explosion is to be avoided at all costs</li>
<li>Many small simple well named classes are the key to well organized code</li>
<li>Unit tests really don&#8217;t test anything useful</li>
<li>Dependency injection leads to an unusable mess</li>
<li>Dependency Injection is a very useful tool for making your code extensible and easily reused&#8221;</li>
<li>Inheritance leads to solid code reuse</li>
<li>Inheritance is the strongest coupling of your code you can have</li>
<li>Functional programming simplifies and minimizes the complexity of your code</li>
<li>Functional programing just makes my eyes bleed!</li>
<li>Static global references are &#8216;just programming&#8217; and something you have to learn how to manage to make simple easy to understand code</li>
<li>Static global spiderwebs are crippling to maintenance and program lifetime</li>
</ul>
<p>&nbsp;</p>
<p>The part that is most difficult about that list for me is while I agree with half of it strongly and respect the people who said those things,  the other half that list I do not agree with, has all come from people I respect and who overall do some pretty impressive things. They&#8217;ve certainly created things by all measures more impressive than anything I&#8217;ve ever produced</p>
<p>This leads me to question how much do software principles matter when taking them out of the context of yourself but viewing it in a bigger picture.  Thinking about it, 95% of the software that I actually like probably wasn&#8217;t using any TDD at any point in time and certainly violates a number of things that I would consider required for &#8220;professional software&#8221;.  I keep reinforcing this fact every time I checkout the source of a major software project I&#8217;ve used for years and gasp in horror at the spaghetti code I find.</p>
<p>Worse still the different schools of thought are not compatible in the slightest, and one side views the other side as wholly unprofessional (granted for different reasons) to the point that I&#8217;ve realized I myself was perceived as the one being &#8220;amateur&#8221; by those with a different definition of what makes good and bad software. I of course unfortunately often thought the same of them, regardless of how I felt about them personally.</p>
<p>Anyway, this is all food for thought and I have not yet come to any conclusion what it all means. It&#8217;s just easily the most frustrating thing about our profession and has on more than a few occasions had me long to return to being a sysadmin (too bad I really love making things).  I know I&#8217;ve tried coding under other schools of thought and while through practice I was able to deliver well enough, I&#8217;m far slower and more error prone with no TDD, big mega classes, and avoiding dependency injection</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/ryansvihla/2011/02/04/the-difficult-definition-of-professional-software-development/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Java IoC containers and classpath scanning (or what I’ve been looking for from .NET for months)</title>
		<link>http://lostechies.com/ryansvihla/2010/09/19/java-ioc-containers-and-classpath-scanning-or-what-i-ve-been-looking-for-from-net-for-months/</link>
		<comments>http://lostechies.com/ryansvihla/2010/09/19/java-ioc-containers-and-classpath-scanning-or-what-i-ve-been-looking-for-from-net-for-months/#comments</comments>
		<pubDate>Sun, 19 Sep 2010 19:01:00 +0000</pubDate>
		<dc:creator>Ryan Svihla</dc:creator>
				<category><![CDATA[IoC]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">/blogs/rssvihla/archive/2010/09/19/java-ioc-containers-and-classpath-scanning-or-what-i-ve-been-looking-for-from-net-for-months.aspx</guid>
		<description><![CDATA[Frustrated with the typical way I saw IoC used in Java where every example I found involved thousands of lines of XML and/or Java code to configure Java beans or components.&#160; This is very different than IoC typically used in&#160;&#8230; <a href="http://lostechies.com/ryansvihla/2010/09/19/java-ioc-containers-and-classpath-scanning-or-what-i-ve-been-looking-for-from-net-for-months/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Frustrated with the typical way I saw IoC used in Java where every example I found involved thousands of lines of XML    <br />and/or Java code to configure Java beans or components.&#160; This is very different than IoC typically used in .NET where most IoC containers allow     <br />you to &quot;autowire&quot; in their terminology up every class in an assembly with a couple of lines of code.&#160; Having been coding in that fashion     <br />for several years in .NET I was dismayed when none of my fellow Java coders that I worked with or knew personally had any concept     <br />of the equivalent functionality, and instead informed me the IDE would be my help in maintaining these massive XML files. </p>
<p>Not content with their answers I burrowed into Spring, Guice and PicoContainer docs and found &quot;classpath scanning&quot; which is roughly    <br />equivalent to &quot;autowire&quot; in .NET. Below is an example of this in Spring 3:</p>
<p>MyStuff.java (my main class note his has 2 dependencies which you can view on my <a href="http://github.com/rssvihla/SpringDemo/tree/master/src/org/foo" target="_blank">github repo</a>)</p>
<div style="padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px" class="wlWriterEditableSmartContent">
<div style="font-family:consolas,lucida console,courier,monospace">
<span style="color:#008000"><b>package</b></span>&#160;org<span style="color:#666666">.</span><span style="color:#7D9029">foo</span><span style="color:#666666">;</span></p>
<p><span style="color:#008000"><b>import</b></span>&#160;<span style="color:#0000FF"><b>org.springframework.beans.factory.annotation.Autowired</b></span><span style="color:#666666">;</span><br />
<span style="color:#008000"><b>import</b></span>&#160;<span style="color:#0000FF"><b>org.springframework.stereotype.Service</b></span><span style="color:#666666">;</span></p>
<p><span style="color:#AA22FF">@Service</span>&#160;<span style="color:#408080"><i>//one&#160;way&#160;of&#160;marking&#160;this&#160;as&#160;a&#160;component&#160;to&#160;register<br />
</i></span><span style="color:#008000"><b>public</b></span>&#160;<span style="color:#008000"><b>class</b></span>&#160;<span style="color:#0000FF"><b>MyStuff</b></span>&#160;<span style="color:#666666">{</span><br />
&#160;&#160;&#160;&#160;<span style="color:#008000"><b>private</b></span>&#160;<span style="color:#008000"><b>final</b></span>&#160;DependencyWithNoInterface&#160;first<span style="color:#666666">;</span><br />
&#160;&#160;&#160;&#160;<span style="color:#008000"><b>private</b></span>&#160;<span style="color:#008000"><b>final</b></span>&#160;DependencyInterface&#160;second<span style="color:#666666">;</span></p>
<p>&#160;&#160;&#160;&#160;<span style="color:#AA22FF">@Autowired</span>&#160;<span style="color:#408080"><i>//tells&#160;spring&#160;which&#160;constructor&#160;to&#160;use&#160;for&#160;it&#8217;s&#160;dependencies<br />
</i></span>&#160;&#160;&#160;&#160;<span style="color:#008000"><b>public</b></span>&#160;<span style="color:#0000FF">MyStuff</span><span style="color:#666666">(</span>DependencyWithNoInterface&#160;first<span style="color:#666666">,</span>&#160;DependencyInterface&#160;second<span style="color:#666666">)</span>&#160;<span style="color:#666666">{</span></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#008000"><b>this</b></span><span style="color:#666666">.</span><span style="color:#7D9029">first</span>&#160;<span style="color:#666666">=</span>&#160;first<span style="color:#666666">;</span><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#008000"><b>this</b></span><span style="color:#666666">.</span><span style="color:#7D9029">second</span>&#160;<span style="color:#666666">=</span>&#160;second<span style="color:#666666">;</span><br />
&#160;&#160;&#160;&#160;<span style="color:#666666">}</span></p>
<p>&#160;&#160;&#160;&#160;<span style="color:#008000"><b>public</b></span>&#160;<span style="color:#B00040">void</span>&#160;<span style="color:#0000FF">run</span><span style="color:#666666">(){</span><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;System<span style="color:#666666">.</span><span style="color:#7D9029">out</span><span style="color:#666666">.</span><span style="color:#7D9029">println</span><span style="color:#666666">(</span><span style="color:#BA2121">&#8220;foo&#160;me&#8221;</span><span style="color:#666666">);</span><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;first<span style="color:#666666">.</span><span style="color:#7D9029">foo</span><span style="color:#666666">();</span><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;second<span style="color:#666666">.</span><span style="color:#7D9029">superFoo</span><span style="color:#666666">();</span><br />
&#160;&#160;&#160;&#160;<span style="color:#666666">}</span><br />
<span style="color:#666666">}</span>
</div>
</div>
<p>appContext.xml (seems you still need some XML)</p>
<div style="padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px" class="wlWriterEditableSmartContent">
<div style="font-family:consolas,lucida console,courier,monospace">
<span style="color:#BC7A00">&lt;?xml&#160;version=&#8221;1.0&#8243;&#160;encoding=&#8221;UTF-8&#8243;?&gt;</span><br />
<span style="color:#008000"><b>&lt;beans</b></span>&#160;<span style="color:#7D9029">xmlns=</span><span style="color:#BA2121">&#8220;http://www.springframework.org/schema/beans&#8221;</span><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#7D9029">xmlns:xsi=</span><span style="color:#BA2121">&#8220;http://www.w3.org/2001/XMLSchema-instance&#8221;</span><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#7D9029">xmlns:context=</span><span style="color:#BA2121">&#8220;http://www.springframework.org/schema/context&#8221;</span><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#7D9029">xsi:schemaLocation=</span><span style="color:#BA2121">&#8220;http://www.springframework.org/schema/beans<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;http://www.springframework.org/schema/beans/spring-beans-3.0.xsd<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;http://www.springframework.org/schema/context<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;http://www.springframework.org/schema/context/spring-context-3.0.xsd&#8221;</span><span style="color:#008000"><b>&gt;</b></span><br />
&#160;&#160;&#160;&#160;&#160;<span style="color:#008000"><b>&lt;context:component-scan</b></span>&#160;<span style="color:#7D9029">base-package=</span><span style="color:#BA2121">&#8220;org.foo&#8221;</span><span style="color:#008000"><b>/&gt;</b></span><br />
<span style="color:#008000"><b>&lt;/beans&gt;</b></span>
</div>
</div>
<p>Application.java (the initialization)</p>
<div style="padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px" class="wlWriterEditableSmartContent">
<div style="font-family:consolas,lucida console,courier,monospace">
<span style="color:#008000"><b>package</b></span>&#160;org<span style="color:#666666">.</span><span style="color:#7D9029">foo</span><span style="color:#666666">;</span></p>
<p><span style="color:#008000"><b>import</b></span>&#160;<span style="color:#0000FF"><b>org.springframework.context.ApplicationContext</b></span><span style="color:#666666">;</span><br />
<span style="color:#008000"><b>import</b></span>&#160;<span style="color:#0000FF"><b>org.springframework.context.support.ClassPathXmlApplicationContext</b></span><span style="color:#666666">;</span></p>
<p><span style="color:#008000"><b>public</b></span>&#160;<span style="color:#008000"><b>class</b></span>&#160;<span style="color:#0000FF"><b>Application</b></span>&#160;<span style="color:#666666">{</span><br />
&#160;&#160;&#160;&#160;<span style="color:#008000"><b>public</b></span>&#160;<span style="color:#008000"><b>static</b></span>&#160;<span style="color:#B00040">void</span>&#160;<span style="color:#0000FF">main</span><span style="color:#666666">(</span>String&#160;args<span style="color:#666666">[]){</span><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ApplicationContext&#160;ctx&#160;<span style="color:#666666">=</span>&#160;&#160;&#160;<span style="color:#008000"><b>new</b></span>&#160;ClassPathXmlApplicationContext<span style="color:#666666">(</span><span style="color:#BA2121">&#8220;appContext.xml&#8221;</span><span style="color:#666666">);</span>&#160;<span style="color:#408080"><i>//the&#160;IoC&#160;container<br />
</i></span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;MyStuff&#160;stff&#160;<span style="color:#666666">=</span>&#160;ctx<span style="color:#666666">.</span><span style="color:#7D9029">getBean</span><span style="color:#666666">(</span>MyStuff<span style="color:#666666">.</span><span style="color:#7D9029">class</span><span style="color:#666666">);</span>&#160;<span style="color:#408080"><i>//my&#160;fully&#160;injected&#160;class<br />
</i></span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;stff<span style="color:#666666">.</span><span style="color:#7D9029">run</span><span style="color:#666666">();</span><br />
&#160;&#160;&#160;&#160;<span style="color:#666666">}</span><br />
<span style="color:#666666">}</span>
</div>
</div>
<p>&#160;</p>
<p>&#160;</p>
<p>Now I’m sure for the .NET developers familiar with StructureMap, Windsor, Autofac, etc this is completely unimpressive. I’m also sure there are Java developers that are somewhat unimpressed with this but for reasons that involve holding onto giant configuration artifacts. <strong>Manual IoC component registration falls where hand writing SQL for trivial data access does for me, extra repetitive work that has been solved years ago</strong>. </p>
<p>Edit:</p>
<p>It appears you can forgo XML as well in your main class use a different Application context and add the refresh and scan lines</p>
<div style="padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px" class="wlWriterSmartContent">
<div style="font-family: consolas,lucida console,courier,monospace"><span style="color: #008000"><b>package</b></span> org<span style="color: #666666">.</span><span style="color: #7d9029">foo</span><span style="color: #666666">;</span>       </p>
<p><span style="color: #008000"><b>import</b></span>&#160;<span style="color: #0000ff"><b>org.springframework.context.annotation.AnnotationConfigApplicationContext</b></span><span style="color: #666666">;</span>       </p>
<p><span style="color: #008000"><b>public</b></span>&#160;<span style="color: #008000"><b>class</b></span>&#160;<span style="color: #0000ff"><b>Application</b></span>&#160;<span style="color: #666666">{</span>       <br />&#160;&#160;&#160; <span style="color: #008000"><b>public</b></span>&#160;<span style="color: #008000"><b>static</b></span>&#160;<span style="color: #b00040">void</span>&#160;<span style="color: #0000ff">main</span><span style="color: #666666">(</span>String args<span style="color: #666666">[]){</span>       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; AnnotationConfigApplicationContext ctx <span style="color: #666666">=</span>&#160;&#160; <span style="color: #008000"><b>new</b></span> AnnotationConfigApplicationContext<span style="color: #666666">();</span>&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ctx<span style="color: #666666">.</span><span style="color: #7d9029">scan</span><span style="color: #666666">(</span><span style="color: #ba2121">&quot;org.foo&quot;</span><span style="color: #666666">);</span>&#160;<span style="color: #408080"><i>//scans the org.foo package          <br /></i></span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ctx<span style="color: #666666">.</span><span style="color: #7d9029">refresh</span><span style="color: #666666">();</span>&#160;<span style="color: #408080"><i>//needed to load them for some reason          <br /></i></span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; MyStuff stff <span style="color: #666666">=</span> ctx<span style="color: #666666">.</span><span style="color: #7d9029">getBean</span><span style="color: #666666">(</span>MyStuff<span style="color: #666666">.</span><span style="color: #7d9029">class</span><span style="color: #666666">);</span>       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; stff<span style="color: #666666">.</span><span style="color: #7d9029">run</span><span style="color: #666666">();</span>       <br />&#160;&#160;&#160; <span style="color: #666666">}</span>       <br /><span style="color: #666666">}</span>       </div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/ryansvihla/2010/09/19/java-ioc-containers-and-classpath-scanning-or-what-i-ve-been-looking-for-from-net-for-months/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Anti-Pattern: Too much of your application is about interacting with external resources</title>
		<link>http://lostechies.com/ryansvihla/2010/07/16/anti-pattern-too-much-of-your-application-is-about-interacting-with-external-resources/</link>
		<comments>http://lostechies.com/ryansvihla/2010/07/16/anti-pattern-too-much-of-your-application-is-about-interacting-with-external-resources/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 02:24:00 +0000</pubDate>
		<dc:creator>Ryan Svihla</dc:creator>
				<category><![CDATA[Anti-Patterns]]></category>

		<guid isPermaLink="false">/blogs/rssvihla/archive/2010/07/15/anti-pattern-too-much-of-your-application-is-about-interacting-with-external-resources.aspx</guid>
		<description><![CDATA[Firstly, what am I talking about? Applications that meet some of the following descriptions: Stored procedures with a fair amount of conditional logic or complicated business rules buried in a sub-query (some would argue sprocs at all). Web pages with&#160;&#8230; <a href="http://lostechies.com/ryansvihla/2010/07/16/anti-pattern-too-much-of-your-application-is-about-interacting-with-external-resources/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Firstly, what am I talking about? Applications that meet some of the following descriptions:</p>
<ol>
<li>Stored procedures with a fair amount of conditional logic or complicated business rules buried in a sub-query (some would argue sprocs at all).</li>
<li>Web pages with lots of conditional output again encoding business rules in snippets of view logic. if else checks that display the latest price for something if before and certain date or a default price.</li>
<li>The majority of ‘unit tests’ require a database, or web and application server to be up and running.</li>
<li>The majority of code files make reference to language default I/O or database libraries.</li>
<li>Hours are spent trying to determine if differences in version of infrastructure are the cause of certain bugs.</li>
<li>Changing database schema results in hours of refactoring, as hundreds of querys and sprocs are hunted through to see if this index or that index is being properly hit.</li>
</ol>
<p>Why is this an anti-pattern? First before I bore you with endless reasoning behind SOLID principles, proper OO etc if you’re reading this and you’re of a bent that disagrees with me so far entirely..none of that will mean anything to you, and none of it will mean anything to your customers so let me put this in the most practical terms I can. </p>
<p><em><strong>It is not testable in the slightest in any practical sense</strong></em>. You will be counter with well that with that sort of application and making everything a front to back test that you KNOW when things are working, <em><strong>yes but you RARELY if EVER know in a quick sense why things are not working.</strong></em> If i can reliably eliminate any chance that my actual code or business logic is the cause of a problem, if all of my fancy business rules are in something that can be run thousands of times a second, then I can throw all sorts of corner cases at my code base and not increase my verification time. If the majority of my application is business logic and plain old code then I can save my slow manual testing to the areas that are so bullet proof and only have a slice of my application doing front to back testing to yes, make sure things really work.</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/ryansvihla/2010/07/16/anti-pattern-too-much-of-your-application-is-about-interacting-with-external-resources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Management in Java: A Confused .NET Developer’s Perspective</title>
		<link>http://lostechies.com/ryansvihla/2010/07/12/project-management-in-java-a-confused-net-developer-s-perspective/</link>
		<comments>http://lostechies.com/ryansvihla/2010/07/12/project-management-in-java-a-confused-net-developer-s-perspective/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 11:00:00 +0000</pubDate>
		<dc:creator>Ryan Svihla</dc:creator>
				<category><![CDATA[Ivy]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[MSBuild]]></category>

		<guid isPermaLink="false">/blogs/rssvihla/archive/2010/07/12/project-management-in-java-a-confused-net-developer-s-perspective.aspx</guid>
		<description><![CDATA[When I was first introduced to workplace Java the amount of ways one could define a project appeared to be restrictive, confusing and a point of frequent friction. While those things may all be true, it’s a great deal better&#160;&#8230; <a href="http://lostechies.com/ryansvihla/2010/07/12/project-management-in-java-a-confused-net-developer-s-perspective/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When I was first introduced to workplace Java the amount of ways one could define a project appeared to be restrictive, confusing and a point of frequent friction. While those things may all be true, it’s a great deal better than I would have expected since I was coming from a world where an upgrade to a newer version of Visual Studio requires your whole team to sync up to that same version!&#160; So how do cross IDEA teams get any work done in the Java workplace? Do Java OSS projects require everyone uses Eclipse, NetBeans, or IntelliJ?&#160; Does every new IDE need to have import/export filters for all of the other existing ones and if it becomes popular do the already present IDE’s have to include this? Which system is the best and what matters?</p>
<p>To answer these questions let break down what makes a project and while doing so compare and contrast the Java perspective with the .NET one.</p>
<h3>Compilation</h3>
<p>Java IDE’s (Intellij/Eclipse/Netbeans) – basically run “make” on the fly and pass everything to javac.</p>
<p>JAVA IDE (Maven, Gradle) -agnostic project systems – adding all the references contained directly to the classpath and then calling javac.</p>
<p>.NET (Visual Studio,MSBuild)&#160; – MSBuild feeds all references to csc.</p>
<p>In summary, there is more similar than different here.</p>
<h3>Strong Versioning</h3>
<p>Java IDE’s – at least in the case of IntelliJ I ended up manually writing a MANIFEST.MF file.</p>
<p>Java IDE-agnostic project systems – still manual editing a lot of the time but usually just one line already filled out by your template that you edit.&#160; I know NetBeans gives you a GUI to edit this. </p>
<p>.NET – GUI but you can manually edit an assembly.cs file. </p>
<p>In summary,&#160; Java IDE’s at least in the case of IntelliJ really are using default Java by hand stuff.</p>
<h3>Dependencies</h3>
<p>Java IDE’s&#160; – All use convention! Basically, search for jar files in your source tree, if the IDE finds them it assumes you need them and adds them as references in your project format. Works pretty nice on a whole and allows for manual tweaking in the oddball cases.</p>
<p>Java IDE &#8211; agnostic project systems&#160; – requires explicit dependency reference by version, however they will download them automatically from remote locations and put them in your file-system in a specific way (defined by them unless overridden by you). Since both of these are also responsible for your compilation you have to basically run everything through them or your IDE has to be aware of them.</p>
<p>.NET – requires explicit reference to DLL’s on the file system.</p>
<p>In summary, .NET and the Java IDE-agnostic systems are VERY similar here in approach, whereas the Java IDE’s take a convention over configuration approach. I’d say there are times I definitely prefer the Java IDE approach and there are times the capabilities of the Java IDE-agnostic systems are worth it.</p>
<h3></h3>
<h3>Source References</h3>
<p>All Java solutions – do reference by directory structure and wild card matching.</p>
<p>.NET – explicit references to <strong><u>each class file</u></strong> .</p>
<p>In summary, this is the HUGE difference. Java takes more of a Make based approach where it’s EXPECTED this will not be the only IDE/project system ever used on this source tree, and this is where the Visual Studio/.NET experience starts to fall apart when trying to use cross-ide’s or versions. It has forced everyone to implement and keep up with MSBuild’s format to enable other IDE’s to be used, and don’t talk about actual alternatives to MSBuild. At this point even though things like NAnt and Rake/Albacore are more popular among agile .NET teams than scripting MSBuild almost all of those scripts still call MSBuild to do the compile step! </p>
<h3>Questions Answered</h3>
<p>Q. How do Java OSS projects deal with all the different IDE’s out there and even different project formats?/How do cross IDE teams get work done?</p>
<p>A. They don’t have to worry about it as much as .NET devs. A friend of mine who a lead contributor to the Apache Cassandra project in fact included a Maven file for the “enterprise types” but by and large use Ant’s to do their builds and he himself has used a number of IDE’s on that same codebase. .NET OSS development is still a bit hamstrung by MSBuild and really alternative IDE’s are keeping in sync with that project management format. There are real problems with style and code format guidelines, but there are usually workarounds or ways of solving this if code style guidelines is something you really care about ( which I don’t).</p>
<p>Q. Which system is the best?</p>
<p>A. There is no one size fits all answer here. I now know Apache Maven solves some problems for people and even though I don’t appreciate it’s approach to things, it’s done some valuable good for the community.&#160; The IDE-centric approach really works pretty well a lot of the time for projects. Gradle, while being the closest to what I want is very young and has limited IDE support, at least it’s not easy enough for this Java n00b to figure out how to use with IntelliJ without some friction.</p>
<h3>Summary</h3>
<p>I hope that all wasn’t too confusing, it sure was for me to go through while I had all these options , and in a completely different environment to what I was used to. Worse a lot of the folks I talked to saw these IDE-agnostic project systems as solving problems they didn’t have. Maven, Ivy, etc was a world that was buzzword laden (I’m really looking at you Maven and Ivy), involved heavy setup time for relatively simple tasks, incomplete documentation (looking at you Gradle) and was frequently badly misused (those who know me know what I’m referring too here). In the end an IDE-centric approach in the Java world does not seem to tie you to that IDE in any way I can find, and for getting started had little friction, and for people new to Java it seemed to be the best way to get started. Besides in Java at least it’s easy to change your mind later.</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/ryansvihla/2010/07/12/project-management-in-java-a-confused-net-developer-s-perspective/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>MySQL 5 Performance Tuning Toolkit</title>
		<link>http://lostechies.com/ryansvihla/2010/07/02/mysql-5-performance-tuning-toolkit/</link>
		<comments>http://lostechies.com/ryansvihla/2010/07/02/mysql-5-performance-tuning-toolkit/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 02:57:00 +0000</pubDate>
		<dc:creator>Ryan Svihla</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">/blogs/rssvihla/archive/2010/07/01/mysql-5-performance-tuning-toolkit.aspx</guid>
		<description><![CDATA[Recently we’d played with table partitioning and because of the limitations of it and some decisions we’d made a very long time ago we ended up spending a couple of days tracking down hotspots. In the process I picked up&#160;&#8230; <a href="http://lostechies.com/ryansvihla/2010/07/02/mysql-5-performance-tuning-toolkit/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently we’d played with table partitioning and because of the limitations of it and some decisions we’d made a very long time ago we ended up spending a couple of days tracking down hotspots. In the process I picked up a few tricks, I’m not even an authority on any of this but I figured it’d help out others in the same spot.</p>
<h3>Logging Toolkit</h3>
<p>If you have a slow loading page or test and have no idea which one of the thirty or so queries going on is the cause how to do you find it.&#160; Slow query log and logging queries that are not using indexes. Adding the following to your my.ini, my.cnf or whatever your mysql config file is named on your system and you’ll be able to get a list of offenders to further investigate.</p>
<h3>MySQL Console Toolkit</h3>
<p>SHOW INNODB STATUS – gives tons of useful information on what the current state of deadlocks, transactions and all sorts of information.</p>
<p>SHOW FULL PROCESSLIST – shows the current threads and queries running on them. running this over and over again can show you queries that are hanging.</p>
<p>EXPLAIN &lt;QUERY&gt;– Just in place of query type your full query statement, particularly in sub-queries, this is great for pointing out potential problems, in my most recent case I had an uncacheable sub-query, pointing out quickly something that was just not going to work no matter what. </p>
<h3></h3>
<h3>Final Notes</h3>
<p>Anyway this is only a smidgen of the useful stuff you need in your toolkit and I’m certainly no expert. I want to plug <a href="http://www.amazon.com/gp/product/0596101716/ref=s9_simh_gw_p14_i1?pf_rd_m=ATVPDKIKX0DER&amp;pf_rd_s=center-http://www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/0596101716/ref=pd_sim_b_1">High Performance MySQL: Optimization, Backups, Replication, and More</a> and the <a href="http://www.mysqlperformanceblog.com/">http://www.mysqlperformanceblog.com/</a> for it’s help and as a reference for those wanting to go into deeper study.</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/ryansvihla/2010/07/02/mysql-5-performance-tuning-toolkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Dependency Management with Apache Ivy</title>
		<link>http://lostechies.com/ryansvihla/2010/06/29/java-dependency-management-with-apache-ivy/</link>
		<comments>http://lostechies.com/ryansvihla/2010/06/29/java-dependency-management-with-apache-ivy/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 13:10:00 +0000</pubDate>
		<dc:creator>Ryan Svihla</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">/blogs/rssvihla/archive/2010/06/29/java-dependency-management-with-apache-ivy.aspx</guid>
		<description><![CDATA[Not wanting to ditch your already built well working ant scripts for the plugin-centric view of Maven, especially if your project structure doesn&#8217;t line up quite right with Maven&#8217;s point of view? Enter Apache Ivy which like Maven can automatically&#160;&#8230; <a href="http://lostechies.com/ryansvihla/2010/06/29/java-dependency-management-with-apache-ivy/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Not wanting to ditch your already built well working ant scripts for the plugin-centric view of Maven, especially if your project structure doesn&#8217;t line up quite right with Maven&#8217;s point of view?  Enter Apache Ivy which like Maven can automatically download and resolve all of your dependencies and their dependencies for you with just a few simple lines of XML (if only I could get rid of the XML Part).</p>
<p><span style="font-size: 14px;font-weight: bold">Pros</span></p>
<ul>
<li>Integrates with Ant, but can still be run standalone.</li>
<li>By default dumps all dependencies into your lib folder which makes it super easy to use with most IDE&#8217;s.</li>
<li>Works with existing Maven 2 repositories, allowing you to leverage work already done by the Maven community.</li>
</ul>
<h3>Cons</h3>
<ul>
<li>Despite lots of documentation, too much focus on theory with little practical example of how to do simple things. Maybe I&#8217;m missing something but I did waste a fair amount of time trying to get a custom 3rd party repository working without crippling the defaults for Ivy.  Again I may be just dense, but this was harder for me than either Gradle or Maven to do, and I ran into a couple of hiccups from there.</li>
<li>Limited IDE support compared to say Maven at least in the case of Intellij. Part of this is Maven has some pretty snazzy integration with Maven and I know on more than a couple of occasions I&#8217;ve just started projects with Maven because Intelij makes it super simple and gives me lots of nice integration for adding dependencies with the classic alt+enter .</li>
</ul>
<p>I decided to include the default scripts I start with. This should get you up and running and give you a template for solving some of the hassle I went through.  Just place next to each other in your top level project directory, ivy.xml, ivysettings.xml, and build.xml if you plan on using Ant integration. Also for ant integration make sure you have ivy-2.1.0.jar in &#8220;$ANT_HOME/lib&#8221; and all should be well.  Please ask for clarification on anything, I&#8217;ll do another post if I get enough questions.</p>
<p>&nbsp;</p></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/ryansvihla/2010/06/29/java-dependency-management-with-apache-ivy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hibernate Connection Pooling: why isn&#8217;t the default one for production?</title>
		<link>http://lostechies.com/ryansvihla/2010/06/26/hibernate-connection-pooling-why-is-the-default-one-for-production/</link>
		<comments>http://lostechies.com/ryansvihla/2010/06/26/hibernate-connection-pooling-why-is-the-default-one-for-production/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 13:50:00 +0000</pubDate>
		<dc:creator>Ryan Svihla</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">/blogs/rssvihla/archive/2010/06/26/hibernate-connection-pooling-why-is-the-default-one-for-production.aspx</guid>
		<description><![CDATA[Hibernate unlike NHibernate comes with a variety of connection pooling options. The three primary ones of which I&#8217;m aware are Proxool, Apache DBCP, and c3p0 . I myself have only so far used c3p0 and it works quite well having&#160;&#8230; <a href="http://lostechies.com/ryansvihla/2010/06/26/hibernate-connection-pooling-why-is-the-default-one-for-production/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hibernate unlike NHibernate comes with a variety of connection pooling options. The three primary ones of which I&#8217;m aware are <a href="http://proxool.sourceforge.net/">Proxool</a>, <a href="http://commons.apache.org/dbcp/">Apache DBCP</a>, and <a href="http://sourceforge.net/projects/c3p0/">c3p0</a> . I myself have only so far used c3p0 and it works quite well having saved me from a couple of jams so far where the default one was in use previously.  First why not use the default one? Because the official Hibernate documentation says in a big yellow box marked caution the following words:</p>
<p><span style="font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif;color: #533500;line-height: 18px"></span></p>
<blockquote><p>The built-in Hibernate connection pool is in no way intended for production use. It lacks several features found on any decent connection pool.</p></blockquote>
<p>Yet on almost every single Java project I&#8217;ve worked on the default is in use.  I wouldn&#8217;t care so much but this has personally wasted a fair amount of time for me and I&#8217;ve had to approach this as an outsider every time getting into the argument &#8220;it hasn&#8217;t cause any issues before&#8221;.  Yet usually within a couple of days of that discussion I or someone else has resolved a &#8220;well it just does that sometimes&#8221; problem just by switching the connection pool. However, in implementing an alternate connection pool I should share a couple of gotcha&#8217;s</p>
<p>1) Turn on logging for Hibernate and read the logs and make sure your connection pool of choice is actually activated and not the default one.</p>
<p>2) Older examples of the documentation I found for c3p0 did not include the necessary line for the C3P0Connection provider. If this line is not included in version 3.x version of hibernate regardless of what else is configured hibernate will use the default connection pool.</p>
<p>3) If the class you specified for connection provider line is not found for some reason, also the default connection pool will be used. Depending on your version of hibernate you may have to reference a different jar.</p>
<p>Below is the config borrowed from the hibernate connection tutorial only with c3p0 configured, please borrow it instead of using the default one.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/ryansvihla/2010/06/26/hibernate-connection-pooling-why-is-the-default-one-for-production/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic DNS with Amazon EC2 Linux and EveryDNS</title>
		<link>http://lostechies.com/ryansvihla/2010/06/06/dynamic-dns-with-amazon-ec2-linux-and-everydns/</link>
		<comments>http://lostechies.com/ryansvihla/2010/06/06/dynamic-dns-with-amazon-ec2-linux-and-everydns/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 18:02:32 +0000</pubDate>
		<dc:creator>Ryan Svihla</dc:creator>
				<category><![CDATA[EC2]]></category>

		<guid isPermaLink="false">/blogs/rssvihla/archive/2010/06/06/dynamic-dns-with-amazon-ec2-linux-and-everydns.aspx</guid>
		<description><![CDATA[So I finally sat down and did the math and found out Amazon EC2 was quite a bit cheaper than what I’d been paying for hosting as long as I was willing to prepay for at least a year.&#160; However,&#160;&#8230; <a href="http://lostechies.com/ryansvihla/2010/06/06/dynamic-dns-with-amazon-ec2-linux-and-everydns/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So I finally sat down and did the math and found out Amazon EC2 was quite a bit cheaper than what I’d been paying for hosting as long as I was willing to prepay for at least a year.&#160; However, with EC2 you are getting a dynamic ip’s so what to do? Well I’ve been using EveryDNS for years for my dns hosting and despite it’s recent acquisition by Dyn, Inc it’s still works the same. The scripts that are described below can be downloaded <a href="http://unstabletransit.com/blogfiles/dyndns.tgz" target="_blank">here</a>, what follows is a brief walkthrough.</p>
<ol>
<li>Download EveryDns update script from <a href="http://www.everydns.com/dynamic.php">http://www.everydns.com/dynamic.php</a>&#160; and place it in something like /usr/local/bin. </li>
<li>Create a convenience script in /usr/local/bin that will get your external ip and have it contain the following lines and call it <strong>external-ip.sh . </strong>This is using Amazon’s suggested curl command to find out your EC2 instance Ip address.
<ol>
<li><a href="http://lostechies.com/ryansvihla/files/2011/03/externalip_03406163.png"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" border="0" alt="external-ip" src="http://lostechies.com/ryansvihla/files/2011/03/externalip_thumb_7E5DADA6.png" width="670" height="168" /></a> </li>
</ol>
</li>
<li>Then create a script for the actual dynamic DNS update in /usr/local/bin/ and call it updatedns-sh. This is using the set command to grab the output of external ip and storing it in the variable $1, and then passing that value to the update command. <strong>NOTE: this will update the dns record of ALL your domains with everydns set to dynamic</strong>. If you need to use specific domain names there is a –d flag for the eDNS client.<a href="http://lostechies.com/ryansvihla/files/2011/03/update_3944E070.png"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" border="0" alt="update" src="http://lostechies.com/ryansvihla/files/2011/03/update_thumb_547D3971.png" width="677" height="169" /></a> </li>
<li>create a cron job on your linux distro of choice but the cron job line should look like the following.
<ol>
<li><a href="http://lostechies.com/ryansvihla/files/2011/03/cron_791157A6.png"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" border="0" alt="cron" src="http://lostechies.com/ryansvihla/files/2011/03/cron_thumb_51D70E71.png" width="754" height="38" /></a> </li>
</ol>
</li>
</ol>
<p>For those wishing to comment I’ve cross posted to my blogger account.</p>
<p><a href="http://ryansvihla.blogspot.com/2010/06/dynamic-dns-with-amazon-ec2-linux-and.html">http://ryansvihla.blogspot.com/2010/06/dynamic-dns-with-amazon-ec2-linux-and.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/ryansvihla/2010/06/06/dynamic-dns-with-amazon-ec2-linux-and-everydns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Projects in Java with Maven 2</title>
		<link>http://lostechies.com/ryansvihla/2010/05/23/projects-in-java-with-maven-2/</link>
		<comments>http://lostechies.com/ryansvihla/2010/05/23/projects-in-java-with-maven-2/#comments</comments>
		<pubDate>Sun, 23 May 2010 02:56:22 +0000</pubDate>
		<dc:creator>Ryan Svihla</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">/blogs/rssvihla/archive/2010/05/22/projects-in-java-with-maven-2.aspx</guid>
		<description><![CDATA[NOTE: due to issues with spam I’ve turned off comments, I’ve cross posted on my old blogger account if you have comments. For those of you who don’t know Maven is a build tool/dependency manager/project model. Those in the Microsoft&#160;&#8230; <a href="http://lostechies.com/ryansvihla/2010/05/23/projects-in-java-with-maven-2/">Continue&#160;reading&#160;<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>NOTE: due to issues with spam I’ve turned off comments, I’ve cross posted on my <a href="http://ryansvihla.blogspot.com/2010/05/projects-in-java-with-maven-2.html">old blogger account</a> if you have comments.</p>
<p>For those of you who don’t know Maven is a build tool/dependency manager/project model. Those in the Microsoft space can probably imagine MSBuild + the ability to download all dll’s for you.</p>
<h3>What I liked</h3>
<ol>
<li>Dependency Resolution. Automatic downloading of dependencies rocks in concept. Just specify library name and version and when you compile again it’s there.&#160; No need to check in jar’s into your source tree. </li>
<li>IDE Independence. In practical terms lets you use whatever IDE you want with no import/export.&#160; Intellij, Eclipse and Netbeans all understand maven as a full project format. So your team can all have different IDE’s and not create havoc with one another. </li>
<li>Good Default Project Structure. Tests are in the same location by default, resources for tests and your prod code are in expected places. </li>
</ol>
<h3>What I hated</h3>
<ol>
<li>Inefficient with already downloaded dependencies. It will check remote repositories <em>every time</em> you build even when you specified version number. Now I can see why they did that but not as a default. I mean sure version 1.12 may have had a bad bug and the project hotfixed in a new one with the same version number, but I’d say that’s really unlikely.&#160; In a larger project with several repositories the difference in time to build between this and an alternate dependency manager Apache Ivy is stark. </li>
<li>Very opinionated view of the build process. Those of you used to (N)Ant or Rake will miss the lack of control. The AntRun plugin will help mitigate some of the lose of control. </li>
<li>HOME/.m2/settings.xml . Specific system wide settings do not belong in a build language. The bad heavy friction ideas that it enabled were legion. Just one example was I had to connect to my work VPN even when working on my home OSS projects hosted on github. </li>
<li>Way too XML for for sometimes simple things. To specify the version of java target language version see the figure below, this specifies Java 1.6. </li>
</ol>
<p>&#160;</p>
<div style="padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px" class="wlWriterEditableSmartContent">
<div style="font-family:consolas,lucida console,courier,monospace">
<span style="color:#008000"><b>&lt;build&gt;</b></span><br />
&#160;&#160;<span style="color:#008000"><b>&lt;plugins&gt;</b></span><br />
&#160;&#160;&#160;&#160;<br />
&#160;&#160;&#160;&#160;<span style="color:#008000"><b>&lt;plugin&gt;</b></span><br />
&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#008000"><b>&lt;artifactId&gt;</b></span>maven-compiler-plugin<span style="color:#008000"><b>&lt;/artifactId&gt;</b></span><br />
&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#008000"><b>&lt;configuration&gt;</b></span><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#008000"><b>&lt;source&gt;</b></span>1.6<span style="color:#008000"><b>&lt;/source&gt;</b></span><br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#008000"><b>&lt;target&gt;</b></span>1.6<span style="color:#008000"><b>&lt;/target&gt;</b></span><br />
&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#008000"><b>&lt;/configuration&gt;</b></span><br />
&#160;&#160;&#160;&#160;<span style="color:#008000"><b>&lt;/plugin&gt;</b></span><br />
&#160;&#160;&#160;&#160;<br />
&#160;&#160;<span style="color:#008000"><b>&lt;/plugins&gt;</b></span><br />
<span style="color:#008000"><b>&lt;/build&gt;</b></span>
</div>
</div>
<h3>Summary</h3>
<p>If you have a cross IDE team or are running an OSS java project I find it very hard to ignore Maven. If you are looking for easier dependency management, less verbose build files, and do not care about IDE independence I suggest any number of alternatives such as Apache Buildr, Apache Ivy, Gradle or many others I’m sure I’m forgetting.</p>
]]></content:encoded>
			<wfw:commentRss>http://lostechies.com/ryansvihla/2010/05/23/projects-in-java-with-maven-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

