<?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>Journeyman Programmer &#187; Tools</title>
	<atom:link href="http://journeyman.ivystreetinc.com/?feed=rss2&#038;cat=3" rel="self" type="application/rss+xml" />
	<link>http://journeyman.ivystreetinc.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 28 Jul 2010 12:53:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Defaults: Hibernate Lazy; JPA Eager</title>
		<link>http://journeyman.ivystreetinc.com/?p=119</link>
		<comments>http://journeyman.ivystreetinc.com/?p=119#comments</comments>
		<pubDate>Wed, 09 Jun 2010 13:51:38 +0000</pubDate>
		<dc:creator>JourneyMan</dc:creator>
				<category><![CDATA[Domain]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://journeyman.ivystreetinc.com/?p=119</guid>
		<description><![CDATA[Now this is interesting.
We were trying to debug some Hibernate rich objects we had converted from hbm files to annotations, and the objects were blowing up.&#160; One of our more expertish developers with some Hibernate experience insisted that default fetching was lazy.&#160; We decided to accept that as the word and left certain objects with [...]]]></description>
			<content:encoded><![CDATA[<p>Now this is interesting.</p>
<p>We were trying to debug some Hibernate rich objects we had converted from hbm files to annotations, and the objects were blowing up.&nbsp; One of our more expertish developers with some Hibernate experience insisted that default fetching was lazy.&nbsp; We decided to accept that as the word and left certain objects with their hbms attributing their failure to annotations not doing something mysterious correctly.</p>
<p>Well, I started to write some unit and integration tests on one of the newer annotated objects and was stubbing the data out with HSQL.&nbsp; I noticed that there were errors in running the tests of the nature of&nbsp; failure to hydrate objects.&nbsp; It smelled like eager fetching.&nbsp; </p>
<p>So I made the fetching on the many-to-one relationships explicity lazy in an annotation.&nbsp; I couldn&#8217;t believe it.&nbsp; Searching through the documentation I found this.&nbsp; Who would have thought that Hibernate and JPA have taken two different approaches!</p>
<h1><font color="#000066"><i>Fetch strategies and types</i></font></h1>
<p><font color="#000066"><i>In native Hibernate, many-to-one association are lazy by default.<br />
This means that selecting a list of objects with an HQL query will not<br />
initialize the objects at the other end of the many-to-one association.<br />
In JPA the default fetch type is eager (i.e. non-lazy), with separate<br />
selects. This means that any JPAQL query for an entity that has<br />
many-to-one associations in it will result in an N+1 SELECTS problem<br />
even if those associations are not used. To eliminate the unnecessary<br />
queries, simply set the fetch type to LAZY using:</i></font></p>
<div class="code panel" style="border-width: 1px;">
<div class="codeContent panelContent">
<pre class="code-java">&lt;font color="#000066"&gt;&lt;i&gt; @ManyToOne(fetch=FetchType.LAZY)
&lt;/i&gt;&lt;/font&gt;</pre>
</div>
</div>
<p><font color="#000066"><i>Then, in any JPA query the association can be eagerly fetched using <tt>left join fetch</tt>.</i></font></p>
]]></content:encoded>
			<wfw:commentRss>http://journeyman.ivystreetinc.com/?feed=rss2&amp;p=119</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TDD:  Design for the Conditions</title>
		<link>http://journeyman.ivystreetinc.com/?p=71</link>
		<comments>http://journeyman.ivystreetinc.com/?p=71#comments</comments>
		<pubDate>Wed, 16 Dec 2009 13:14:13 +0000</pubDate>
		<dc:creator>JourneyMan</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://journeyman.ivystreetinc.com/?p=71</guid>
		<description><![CDATA[I am not a proponent of TDD, but I will admit it has its place.  And sometimes that place is not to use it, if the ultimate outcome will be of less value to the purpose of your software.
Some reasons not to use TDD if the conditions warrant are:

More code is higher risk for bugs.  [...]]]></description>
			<content:encoded><![CDATA[<p>I am not a proponent of TDD, but I will admit it has its place.  And sometimes that place is not to use it, if the ultimate outcome will be of less value to the purpose of your software.</p>
<p>Some reasons not to use TDD if the conditions warrant are:</p>
<ul>
<li>More code is higher risk for bugs.  Bottom line.</li>
<li>More expensive.  TDD translates into stories/function points/developer time.  I don&#8217;t care what anyone says, I still like TAD a little better to get repeatable regressive costs over time.</li>
</ul>
<p>Use TDD if you are designing things that will benefit from it.  Don&#8217;t if it will not.</p>
<p><strong>Object Design?</strong></p>
<p>TDD is a <span id="lw_1260966867_0">design pattern</span>, nothing more nothing less.  While I have read a few books about TDD . . . I wonder, if true TDD people refuse to do up front object design.  The methodology demands refactoring; and therefore following a Fowler idea that design will emerge, TDD practitioners must let objects emerge via refactoring.  I mean, if they are TRULY doing TDD that&#8217;s what they would do.</p>
<p><strong>Timeboxing is Agile&#8217;s David</strong></p>
<p>Its an interesting experiment to me; I do refactors and look for patterns.  Then I pull them out if needed.  Unless I come up with an estimate, and the project deadline and my manager says &#8220;no way jsut build it quick.&#8221;  If you get on one of those projects using TDD (I was on one) a LOT of spaghetti code, with lots of test cases, gets written.  Its about as bug proof as any other design style, that is, in those conditions TDD brings no value.</p>
<p>I think its a failure of a lot of Agile methods . . . ignores the reality of timeboxed projects.  I have never worked on anything but; even being relatively young as my first computer class was on a Tandy PET and my first Basic program on a Vic 20.</p>
<p><strong>A Use Case Where TDD would Fail &#8211; SUV Analogy<br />
</strong></p>
<p>I am actually using TDD do do some PL/SQL conversion scripts right now.   I have to do it old school; and its taking time.  Sometimes I just write the conditions.  Since the scripts are throw away it we can&#8217;t store the unit tests in any sort of DB repository (but that would be great for stored procs etc.).  I ran into a bit of a problem though . . . <em><strong>that writing code in TDD style sometimes causes more problems, depending on what you are trying to accomplish.</strong></em></p>
<p>Talking with a friend I came up with this real-life analogy of where TDD would fail.</p>
<p>TDD thinks it addresses quality but one thing it introduces is possible defects  due to itself.   You have to make a judgement call based on your input factors of time, money, and risk as to whether its worth it to use this design pattern.  For example, it would absolutely be worth it if designing space shuttle software.  And, you had an unlimited budget.</p>
<p>But here&#8217;s an analogy where it would fail:</p>
<p>Suppose you are designing an SUV for extreme conditions.  In one case, it&#8217;s a highly wet cool condition and in another, is a hot temperature condition.</p>
<p>The designers decide that testing of everything is very important.  So they design in a hole in the engine that let&#8217;s you test sludge buildup in one of the cylinders:  you unscrew something and get a physical look.  Basically, a test has become part of the design.</p>
<p>But now the cylinder head is weakened because of the test.  You have introduced a few failure conditions:  possible weakened gasket that will let in contamination and cause engine failure.</p>
<ul>
<li>In the wet condition this may be worth while.  Sludge buildup and moisture may be something causes buildup and there would be value to check the state of the cylinder periodically to make sure you don&#8217;t need to run a cleaning process, etc.</li>
<li>But in the hot condition, the gasket could keep failing and contaminants could be introduced via the testing port.  The strategy is just follow a maintenance schedule (TAD &#8211; test after), which you would have done anyway, because everyone has to do maintenance.</li>
</ul>
<p>It&#8217;s just a hypothetical but there are a ton of other things in our life just like this.  Vehicles are easy . . . even now they are building all kinds of testing into the vehicles as part of the design (TDD): emissions, mixture, electric etc.  The payoff is that this is very expensive to pay for, and also in increase costs due to specialized maintenance because your every day Joe or Jane auto mechanic can&#8217;t work on their own vehicle.  Do vehicles really last any longer?  I&#8217;d argue that they do not.  TDD just extended the period between maintenance&#8217;s &#8212; i.e. you paid for your time up front instead of over time.</p>
<p>I&#8217;m not motivated enough to throw away a methodology if it may be useful, and TDD can teach us some things, but I guess the mantra is:  &#8220;<em><strong>TDD: do it only if necessary.</strong></em>&#8220;</p>
]]></content:encoded>
			<wfw:commentRss>http://journeyman.ivystreetinc.com/?feed=rss2&amp;p=71</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating Eclipse Projects From Java 1.5 to Java 1.6</title>
		<link>http://journeyman.ivystreetinc.com/?p=49</link>
		<comments>http://journeyman.ivystreetinc.com/?p=49#comments</comments>
		<pubDate>Fri, 13 Nov 2009 18:15:03 +0000</pubDate>
		<dc:creator>JourneyMan</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://journeyman.ivystreetinc.com/?p=49</guid>
		<description><![CDATA[When you are updating from jdk 1.5 to jdk 1.6 in Eclipse 3.5, make sure you hit all of these  touchpoints:

On your machine, install jdk 1.6 and change your environment path variables to point to the 1.6 directories.
In Eclipse, Under Windows-&#62;Preferences-&#62;Java-&#62;Installed JREs make sure jdk 1.6 is  added, and select it.
In Eclipse, Under Windows-&#62;Preferences-&#62;Java-&#62;Build Path-&#62;Classpath [...]]]></description>
			<content:encoded><![CDATA[<div>When you are updating from jdk 1.5 to jdk 1.6 in Eclipse 3.5, make sure you hit all of these  touchpoints:</div>
<ul>
<li>On your machine, install jdk 1.6 and change your environment path variables to point to the 1.6 directories.</li>
<li>In Eclipse, Under Windows-&gt;Preferences-&gt;Java-&gt;Installed JREs make sure jdk 1.6 is  added, and select it.</li>
<li>In Eclipse, Under Windows-&gt;Preferences-&gt;Java-&gt;Build Path-&gt;Classpath Variables make sure jdk 1.6 is added for JRE_LIB and JRE_SRC.</li>
<li>In Eclipse, Under Windows-&gt;Preferences-&gt;Java-&gt;Compiler set compliance level to 1.6.</li>
<li>In Eclipse, Under Windows-&gt;Preferences-&gt;Ant-&gt;Runtime set classpath variables 1.6.</li>
<li>Update your JBoss server/web server to use the 1.6 runtime.</li>
<li>In each project, change the compiler, the classpaths, the facets, and the runtimes for your servers (as applicable) to use jdk 1.6.</li>
</ul>
<p>Then you should be good to go.  Build using both the Eclipse and the Ant methods to test . . . remember, the Hudson build server (or any build process) uses the ant scripts so if you check in the app with broken scripts you&#8217;ve checked in a bug!</p>
]]></content:encoded>
			<wfw:commentRss>http://journeyman.ivystreetinc.com/?feed=rss2&amp;p=49</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Darcs Distributed Version Control</title>
		<link>http://journeyman.ivystreetinc.com/?p=3</link>
		<comments>http://journeyman.ivystreetinc.com/?p=3#comments</comments>
		<pubDate>Fri, 06 Nov 2009 15:33:17 +0000</pubDate>
		<dc:creator>JourneyMan</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://journeyman.neovocis.com/?p=3</guid>
		<description><![CDATA[In my search for easy to use technology I decided to use the darcs distributed revision control code repository to maintain some of my work-usbstick-website&#8211;home files.
What darcs is:

It&#8217;s an easy to use, distributed, code repository.  It falls into the same category as Mercurial,GIT or Bazaar.
Distributed?  Yes, patches are exchanged between repositories and there is no [...]]]></description>
			<content:encoded><![CDATA[<p>In my search for easy to use technology I decided to use the <a href="http://darcs.net/">darcs</a> distributed revision control code repository to maintain some of my work-usbstick-website&#8211;home files.</p>
<p><strong>What darcs is:</strong></p>
<ul>
<li>It&#8217;s an easy to use, distributed, code repository.  It falls into the same category as Mercurial,GIT or Bazaar.</li>
<li>Distributed?  Yes, patches are exchanged between repositories and there is no one single &#8220;mother&#8221;repository.</li>
<li>Super lightweight; runs locally, super portable, cross platform, and easy to learn. The download is 4 megs.</li>
<li>A great introduction to the world of distributed reversion control.</li>
<li>Doesn&#8217;t do anything to your existing folder and file structures (non-invasive).</li>
</ul>
<p><strong>What is a distributed respository?</strong></p>
<p>Hmmm . . .this definition is different depending on where you look.  Even as of this date (nov 6 2009) Wikipedia doesn&#8217;t have a good definition.</p>
<p>Here is my definition:</p>
<ul>
<li>Not tied to a central repository.</li>
<li>It&#8217;s faster.</li>
<li>Easier to branch.</li>
<li>Work offline and still create commits.</li>
<li>Distributed backups &#8212; everything is a  working copy.</li>
<li>Collaboration between developers without checking into central copy.</li>
<li>It can run locally, easily (especially darcs).</li>
<li>Useful if you are working on a module with a small team within a larger team, and want to revision/track changes with each other but not the full build.</li>
</ul>
<p>I think subversion is a rock solid repository, and quite honestly, I am not a proponent of using technology for its own sake.  The simpler the better. But the future seems to be distributed repositories and maybe with teams working remotely from each other, the advance of SOA, etc. these types of tools will make more sense.  I suggest trying out darcs just because it gives you an idea very quickly what these are all about.</p>
<p><strong>Repository Workflow</strong></p>
<ol>
<li>Clone a repository to your own repository.</li>
<li>Work in the clone &#8212; which is now your working copy.</li>
<li>Check in and out of your working copy from your IDE/cmd line.</li>
<li>When you are ready, commit those changes to another (or original) repository.</li>
</ol>
<p>One way to look at this is, the &#8220;central&#8221; repository is the build server&#8217;s repository, and you have your own.  But just remember, the only thing central about that repository is that everyone agrees its the place where production bound code must end up.</p>
<p>Maybe this sounds disturbing.</p>
<p>In the &#8220;old&#8221; days the shops were so used to having copies of everything out of fear of a developer &#8220;getting hit by a bus&#8221; (which is code for: corporate culture does not trust anyone at all).    Honestly, I have yet to see that scenario. But it does lead us to something I haven&#8217;t seen discussed too much:</p>
<p><strong>Best Practices Using Distributed Reversion Control</strong></p>
<p>I haven&#8217;t thought about this much until now, but here are some of the guidelines I use for a distributed system.</p>
<ul>
<li>Refresh/rebuild in the morning.</li>
<li>Check in when you get a meaningful amount of work done.</li>
<li>Physically back up your directories</li>
<li>Exchange your patches with your team (distributed backups).</li>
</ul>
<p>Sometime when working in a continuous build environments, I will check things in with my feature sets turned off . . . but usually not, if they are not ready.  Also, you can keep a backup of workin progress in another of your own distributed repositories on a network drive (in addition to your local).</p>
<p><strong>Back to Darcs</strong><br />
The scenario I describe here would be using darcs to sync files from an html blog between your local machine and a usb stick.  Let&#8217;s assume you have some files at x:\usb\blog and locally, you want to work on them at c:\local\blog. (I actually use this method for a tiddlywiki &#8220;getting things done&#8221; piece.)</p>
<p>Download <a href="http://darcs.net/">darcs</a> and decompress to a desired location.  Add the directory to your path.</p>
<p>Create your first repository.  Navigate to x:\usb\blog and type:</p>
<p><code>darcs init</code></p>
<p>Next, recursively add all the files and folders from there:</p>
<p><code>darcs add -r *</code></p>
<p>Notice that it skipped all the _darcs files created from the init command!</p>
<p>Run this:</p>
<p><code>darcs whatsnew</code></p>
<p>And you can see all the new files and folders you added.  But we haven&#8217;t saved yet, we have to do this:</p>
<p><code>darcs record -a</code></p>
<p>You get asked a few questions (which can be set on the command line as you get better with the tool) and its all checked in!</p>
<p>Time to get a copy of this repo to the local.</p>
<p>Navigate to c:\local\blog (which should be empty) and type:</p>
<p><code>darcs get x:\usb\blog</code></p>
<p>You have a local copy!  Make changes in your existing files there (on c:\local\blog) and when you are ready, check in your changes:</p>
<p><code>darcs record -a</code></p>
<p>And then run this to propogate those changes to your usb stick &#8212; first change directories to x:\usb\blog and run:</p>
<p><code>darcs pull c:\local\blog</code></p>
<p>And both repositories are sync&#8217;d up.  I wrote a little batch file in my case to automate this.</p>
<p>You are probably wondering why in the world I would want to do such a thing.  Well, I can access the files in my tiddlywiki from several spots, and I don&#8217;t want a brute force copy over of the file least I lose information.  I need the granular capability  Also I also use it to branch &#8212; for instance at year end &#8212; very easy!!!</p>
<p>Of course there are a whole slew of other functions but that&#8217;ll do.  Darcs is the simplest tool to get your feet wet in the world of distributed version control.</p>
]]></content:encoded>
			<wfw:commentRss>http://journeyman.ivystreetinc.com/?feed=rss2&amp;p=3</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
