<?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>Hackerdude &#187; Java</title>
	<atom:link href="http://www.hackerdude.com/category/dev-platforms/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hackerdude.com</link>
	<description>Software Development Blog by David Martinez</description>
	<lastBuildDate>Tue, 06 Apr 2010 05:02:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Concurrency Strategies for Hibernate Caching</title>
		<link>http://www.hackerdude.com/2007/07/30/concurrency-strategies-for-hibernate-caching/</link>
		<comments>http://www.hackerdude.com/2007/07/30/concurrency-strategies-for-hibernate-caching/#comments</comments>
		<pubDate>Mon, 30 Jul 2007 19:07:49 +0000</pubDate>
		<dc:creator>David Martinez</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.hackerdude.com/2007/07/30/concurrency-strategies-for-hibernate-caching/</guid>
		<description><![CDATA[Caching and concurrency management are tricky. If you have a cache that lives in memory but you have updates to the database that the objects originally came from, how are you going to make sure that the cached objects still reflect the contents of the database? This really depends on what type of data you [...]]]></description>
			<content:encoded><![CDATA[<p>Caching and concurrency management are tricky. If you have a cache that lives in memory but you have updates to the database that the objects originally came from, how are you going to make sure that the cached objects still reflect the contents of the database?</p>
<p>This really depends on what type of data you are dealing with. Data types that are mostly read (news, notices, articles) probably benefit from whatever caching you can provide, while areas of data that change a lot (shopping carts, server status records) probably won't benefit from caching at all.</p>
<p>Here are the concurrency strategies on hibernate caching explained:</p>
<p />
<p /><!-- technorati tags begin -->
<p style="font-size:10px;text-align:right;">technorati tags:<br />
<a href="http://technorati.com/tag/hibernate" rel="tag">hibernate</a><br />
<a href="http://technorati.com/tag/java" rel="tag">java</a>
</p>
<p><!-- technorati tags end --></p>
<p><span id="more-511"></span></p>
<ul>
<li><b>Transactional:</b> Full Transaction Isolation, even <a href="http://en.wikipedia.org/wiki/Isolation_(computer_science)#REPEATABLE_READ" title="Repeatable Read Isolation - Wikipedia, the free encyclopedia">repeatable-read</a>. This is not particularly fast, but it does guarantee full transactional isolation.</li>
<li><b>Read-Write:</b> A bit more relaxed than transactional, it uses a timestamp to maintain <a href="http://en.wikipedia.org/wiki/Isolation_(computer_science)#READ_COMMITTED" title="Read Commited Isolation (computer science) - Wikipedia, the free encyclopedia">Read-Commited</a> transaction isolation.</li>
<li><b>Non-Strict Read-Write:</b> With this one, you start ending up with stale data, because since it is not strict it provides no guarantee of consistency. If you think things may be updated and provide you with stale data, set a short timeout for expiration.</li>
<li><b>Read-Only</b>: Use this one for Reference data that never changes (days of months, cities, states, etc).</li>
</ul>
<p>Note that, on hibernate, the concurrency strategies available will depend on your cache provider. Also note that all caching only focuses on things your application updated. If you have other applications also updating data on the same database consider not using caching at all for those classes.</p>
<p>If you insist on using caching in this situation, be prepared for caching errors on production and be ready to do some cache management - provide a way to look into the cache statistics and clear the cached elements, and use timeouts that are sensible.</p>
<p>Finally, caching should be your last option for performance, not your first. I can't tell you how many times I've seen teams want to mess around with the cache settings when they have queries so bloated that would make Windows Vista blush. Fix your query issues first, then apply caching. If you add caching when you haven't fixed underlying query problems you only accomplish two things: Sweeping your problem under the rug (but you can still see the bump), and cause OutOfMemory errors.</p>
<p>Category: Best Practices</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackerdude.com/2007/07/30/concurrency-strategies-for-hibernate-caching/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On the topic of assertions</title>
		<link>http://www.hackerdude.com/2007/03/06/on-the-topic-of-assertions/</link>
		<comments>http://www.hackerdude.com/2007/03/06/on-the-topic-of-assertions/#comments</comments>
		<pubDate>Tue, 06 Mar 2007 23:09:40 +0000</pubDate>
		<dc:creator>David Martinez</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.hackerdude.com/2007/03/06/on-the-topic-of-assertions/</guid>
		<description><![CDATA[Every assertion should be thought from the standpoint of What was expected What actually happened Translation: assertTrue should always, always have a message. Consider the following: &#160; assertTrue&#40;mv.getViewName&#40;&#41; .startsWith&#40;myController.getSuccessView&#40;&#41;&#41;&#41;; &#160; This will only return "assertion failed". Which is great, but how do we know what happened? If this is buried on one of the lunt [...]]]></description>
			<content:encoded><![CDATA[<p>Every assertion should be thought from the standpoint of</p>
<ol>
<li>What was expected</li>
<li>What actually happened</li>
</ol>
<p>Translation: assertTrue should <strong>always, always</strong> have a message.</p>
<p>Consider the following:</p>
<pre class="java">&nbsp;
assertTrue<span style="color: #66cc66;">&#40;</span>mv.<span style="color: #006600;">getViewName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    .<span style="color: #006600;">startsWith</span><span style="color: #66cc66;">&#40;</span>myController.<span style="color: #006600;">getSuccessView</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>This will only return "assertion failed". Which is great, but how do we know what happened? If this is buried on one of the lunt automated remote builds, how am I supposed to know what is going wrong? Which is the expected? What actually happened?</p>
<p>A much better version of the same looks like this:</p>
<pre class="java">&nbsp;
assertTrue<span style="color: #66cc66;">&#40;</span>
    <span style="color: #ff0000;">&quot;Was expecting something like &quot;</span>
        + myController.<span style="color: #006600;">getSuccessView</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">&quot; but was &quot;</span>
        + mv.<span style="color: #006600;">getViewName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>,
    mv.<span style="color: #006600;">getViewName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
        .<span style="color: #006600;">startsWith</span><span style="color: #66cc66;">&#40;</span>myController.<span style="color: #006600;">getSuccessView</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>Same assertion, but now it tells me more specifically what's going on and I can fix bugs with it. Once I set this on the test, it becomes easy to see what was going on.</p>
<p>I recently had a Saturday with some other <a href="http://www.testobsessed.com/2007/02/15/bay-area-td-dt-summit/">Bay Area developers where we did a lot of thinking about testing, so expect some more advice in the future as I collect my notes</a>.</p>
<p>Remember the goal of unit tests is to "find bugs" (thanks <a href="http://www.model-based-testing.org">Harry</a>!). An assertion without an associated message merely notifies you that a bug occurred but doesn't actually "find it". As you are writing your unit tests, make sure you find it as well.</p>
<p><!-- technorati tags begin --></p>
<p style="font-size: 10px; text-align: right">technorati tags:<a rel="tag" href="http://technorati.com/tag/testing">testing</a>, <a rel="tag" href="http://technorati.com/tag/junit">junit</a>, <a rel="tag" href="http://technorati.com/tag/assertions">assertions</a>, <a rel="tag" href="http://technorati.com/tag/java">java</a></p>
<p><!-- technorati tags end --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackerdude.com/2007/03/06/on-the-topic-of-assertions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wazaabi &#8211; XUL for RCP.</title>
		<link>http://www.hackerdude.com/2006/12/08/wazaabi-xul-for-rcp/</link>
		<comments>http://www.hackerdude.com/2006/12/08/wazaabi-xul-for-rcp/#comments</comments>
		<pubDate>Fri, 08 Dec 2006 16:17:31 +0000</pubDate>
		<dc:creator>David Martinez</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mozilla XUL]]></category>
		<category><![CDATA[Web Development: Client Side]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.hackerdude.com/2006/12/08/wazaabi-xul-for-rcp/</guid>
		<description><![CDATA[This opens pretty interesting possibilities: Via TheServerSide: Wazaabi includes a GUI framework that brings XUL to Eclipse RCP plugin developers and a set of components that link the client-side XUL based viewers and forms to server-side business components. Thus, rich client developers can use XUL to code a GUI, rather than using SWT. Wazaabi brings [...]]]></description>
			<content:encoded><![CDATA[<p>This opens pretty interesting possibilities:</p>
<p>
</p>
<p>Via TheServerSide:</p>
<blockquote cite="http://www.theserverside.com/news/thread.tss?thread_id=43385"><p>
Wazaabi includes a GUI framework that brings XUL to Eclipse RCP plugin developers and a set of components that link the client-side XUL based viewers and forms to server-side business components. Thus, rich client developers can use XUL to code a GUI, rather than using SWT.</p></blockquote>
<p class="citation"><cite cite="http://www.theserverside.com/news/thread.tss?thread_id=43385"><a href="http://www.theserverside.com/news/thread.tss?thread_id=43385">Wazaabi brings XUL to Eclipse RCP based rich client applications</a></cite></p>
<p />This is an actual XUL viewer, not a similar syntax like XSWT or similar attempts. They use servlets to communicate between the XUL side and your application, to keep the flexibility of sending the XUL to a mozilla browser. Very interesting.</p>
<p /><!-- technorati tags begin -->
<p style="font-size:10px;text-align:right;">technorati tags:<a href="http://technorati.com/tag/java" rel="tag">java</a>, <a href="http://technorati.com/tag/xul" rel="tag">xul</a>, <a href="http://technorati.com/tag/eclipse" rel="tag">eclipse</a></p>
<p><!-- technorati tags end --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackerdude.com/2006/12/08/wazaabi-xul-for-rcp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Hibernate Validators with Spring and Hibernate</title>
		<link>http://www.hackerdude.com/2006/09/14/using-hibernate-validators-with-spring-and-hibernate/</link>
		<comments>http://www.hackerdude.com/2006/09/14/using-hibernate-validators-with-spring-and-hibernate/#comments</comments>
		<pubDate>Fri, 15 Sep 2006 04:19:33 +0000</pubDate>
		<dc:creator>David Martinez</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[CBBTR]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.hackerdude.com/2006/09/14/using-hibernate-validators-with-spring-and-hibernate/</guid>
		<description><![CDATA[In this article, Ted Bergeron shows you how to use the Validator component of Hibernate Annotations to build and maintain validation logic easily in your Web apps. Hibernate can meet your validation needs technorati tags:java, validation]]></description>
			<content:encoded><![CDATA[<blockquote cite="http://www-128.ibm.com/developerworks/java/library/j-hibval.html"><p>In this article, Ted <span>Bergeron</span> shows you how to use the Validator component of Hibernate Annotations to build and maintain validation logic easily in your Web apps.</p></blockquote>
<p class="citation"><cite cite="http://www-128.ibm.com/developerworks/java/library/j-hibval.html"><a href="http://www-128.ibm.com/developerworks/java/library/j-hibval.html">Hibernate can meet your validation needs</a></cite></p>
<p />
<p /><!-- technorati tags begin -->
<p style="font-size:10px;text-align:right;">technorati tags:<a href="http://technorati.com/tag/java" rel="tag">java</a>, <a href="http://technorati.com/tag/validation" rel="tag">validation</a></p>
<p><!-- technorati tags end --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackerdude.com/2006/09/14/using-hibernate-validators-with-spring-and-hibernate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Web toolkit</title>
		<link>http://www.hackerdude.com/2006/05/17/google-web-toolkit/</link>
		<comments>http://www.hackerdude.com/2006/05/17/google-web-toolkit/#comments</comments>
		<pubDate>Wed, 17 May 2006 15:36:01 +0000</pubDate>
		<dc:creator>David Martinez</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Web Development: Client Side]]></category>

		<guid isPermaLink="false">http://www.hackerdude.com/2006/05/17/google-web-toolkit/</guid>
		<description><![CDATA[Okay, it's official. Now everybody has a web 2.0 solution. With GWT, you can develop and debug AJAX applications in the Java language using the Java development tools of your choice. When you deploy your application to production, the GWT compiler to translates your Java application to browser-compliant JavaScript and HTML. Google Web Toolkit - [...]]]></description>
			<content:encoded><![CDATA[<p>
Okay, it's official. Now <strong>everybody</strong> has a web 2.0 solution.</p>
<blockquote cite="http://code.google.com/webtoolkit/overview.html"><p>With GWT, you can develop and debug AJAX applications in the Java language using the Java development tools of your choice. When you deploy your application to production, the GWT compiler to translates your Java application to browser-compliant JavaScript and HTML.</p></blockquote>
<p class="citation">
<p><cite><a href="http://code.google.com/webtoolkit/overview.html">Google Web Toolkit - Product Overview</a></cite></p>
<p>&nbsp;<br />
Haven't tried it, but it looks like it would work. Of course, the devil is in the details <img src='http://www.hackerdude.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />
</p>
<p>
Myself, I've been using <a href="http://prototype.conio.net/" target="_blank" title="Prototype JS Framework">prototype</a> and <a href="http://script.aculo.us/" title="Scriptaculous Web 2.0 UI library">scriptaculous</a> &quot;raw&quot; (just some JSP tags of my own here and there) on my web application pretty successfully. Remember, in scriptable languages, <a href="http://www.openqa.org/selenium/" target="_blank" title="Selenium testing framework">testing is key</a>.
</p>
<p>
You also learn a lot from reading their source code. But if you are source code illiterate (what a handicap for a programmer!) <a href="http://www.snook.ca/archives/000531.php" target="_blank" title="Prototype Cheatsheet">a cheatsheet</a> or <a href="http://www.sergiopereira.com/articles/prototype.js.html" target="_blank" title="Prototype 1.4 Documentation">documentation</a> can help.</p>
<p><!-- technorati tags begin -->
<p style="font-size:10px;text-align:right;">technorati tags: <a href="http://technorati.com/tag/google" rel="tag">google</a>, <a href="http://technorati.com/tag/webdev" rel="tag">webdev</a>, <a href="http://technorati.com/tag/ajax" rel="tag">ajax</a>, <a href="http://technorati.com/tag/web20" rel="tag">web20</a></p>
<p><!-- technorati tags end --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackerdude.com/2006/05/17/google-web-toolkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eckel on Java vs Rails: The departure of the hyper-enthusiasts</title>
		<link>http://www.hackerdude.com/2005/12/19/eckel-on-java-vs-rails-the-departure-of-the-hyper-enthusiasts/</link>
		<comments>http://www.hackerdude.com/2005/12/19/eckel-on-java-vs-rails-the-departure-of-the-hyper-enthusiasts/#comments</comments>
		<pubDate>Mon, 19 Dec 2005 17:15:27 +0000</pubDate>
		<dc:creator>David Martinez</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.hackerdude.com/2005/12/19/eckel-on-java-vs-rails-the-departure-of-the-hyper-enthusiasts/</guid>
		<description><![CDATA[As always Bruce Eckel is a great read.. The Java hyper-enthusiasts have left the building, leaving a significant contingent of Java programmers behind, blinking in the bright lights without the constant drumbeat of boosterism. But the majority of programmers, who have been relatively quiet all this time, always knew that Java is a combination of [...]]]></description>
			<content:encoded><![CDATA[<p>As always Bruce Eckel is a great read..<br />
<blockquote cite="http://www.artima.com/forums/flat.jsp?forum=106&amp;thread=141312"><font color="#000000" face="tahoma,arial,sans-serif" size="-1"><br />The Java hyper-enthusiasts have left the building, leaving a significant contingent of Java programmers behind, blinking in the bright lights without the constant drumbeat of boosterism.<!--htdig_noindex--><!--/htdig_noindex-->    </font>
<p><font color="#000000" face="tahoma,arial,sans-serif" size="-1">But the majority of programmers, who have been relatively quiet all this time, always knew that Java is a combination of strengths and weaknesses. These folks are not left with any feelings of surprise, but instead they welcome the silence, because it's easier to think and work....</font></p>
<p>Clearly Ruby is making important contributions to the programming world. I think we're seeing the effects sooner in Python than elsewhere, but I suspect it will have an effect on Java as well, eventually, if only in the web-framework aspects. Java-on-rails might actually tempt me into creating a web app using Java again.However, I can't see Ruby, or anything other than C#, impacting the direction of the Java language, because of the way things have always happened in the Java world. And I think the direction that C# 3.0 may be too forward-thinking for Java to catch up to.</p></blockquote>
<p class="citation"><cite cite="http://www.artima.com/forums/flat.jsp?forum=106&amp;thread=141312"><a href="http://www.artima.com/forums/flat.jsp?forum=106&amp;thread=141312">Weblogs Forum - The departure of the hyper-enthusiasts</a></cite></p>
<p>Mainly, I think a pragmatic approach to a language is to assign value based on a) what you can accomplish with it, and b) how easy it is to write in the first place and maintain in the long run. So far Ruby is starting to become interesting on (a) - it was always interesting on (b) -, although we still have to do a lot of stuff in Java if we want to take advantage of a lot of features.</p>
<p>However, in Java there has been a lot of work already done to get you libraries and automated tools. I have been looking for some good IDEs for Ruby and I can't seem to find anything that is better than just using vim (I've looked, but that's another story) - Eclipse is my yardstick for comparison.</p>
<p>That means that I may want to switch to rails for web app development and maybe scripting, but not for any type of development where I have to apply deep pattern thinking and where I anticipate refactorings to come along as the system grows. It may be easier conceptually to do refactoring in Ruby, but that fact is superceded by the automatedness of doing it in Eclipse. It doesn't matter if it impacts a lot more files to, say change a member variable name in a domain object, in Java vs. Ruby if I can do it with Alt-R in Eclipse and in Ruby I have to go and change it manually - the masses will not switch until you give them this kind of capability.</p>
<p>On the other hand, I really do like the fact that you can get started in ruby from scratch in a few minutes using things like "gem install rails", vs. setting up a giant ant/java/spring/hibernate/tomcat on the java side.</p>
<p><!-- technorati tags begin -->
<p style="font-size:10px;text-align:right;">technorati tags: <a href="http://technorati.com/tag/languages" rel="tag">languages</a>, <a href="http://technorati.com/tag/java" rel="tag">java</a>, <a href="http://technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://technorati.com/tag/rails" rel="tag">rails</a>, <a href="http://technorati.com/tag/web2.0" rel="tag">web2.0</a></p>
<p><!-- technorati tags end --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackerdude.com/2005/12/19/eckel-on-java-vs-rails-the-departure-of-the-hyper-enthusiasts/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>RIFE vs Rails side by side</title>
		<link>http://www.hackerdude.com/2005/12/06/rife-vs-rails-side-by-side/</link>
		<comments>http://www.hackerdude.com/2005/12/06/rife-vs-rails-side-by-side/#comments</comments>
		<pubDate>Tue, 06 Dec 2005 21:37:52 +0000</pubDate>
		<dc:creator>David Martinez</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.hackerdude.com/?p=433</guid>
		<description><![CDATA[Like many other java developers, I am currently using Spring and Hibernate, so I can't attest to the quality of RIFE. But I thought this was interesting: This is a side-by-side comparison of the RIFE source vs. the Rails source for the same feature (Ta-da list vs Bla bla list). Just another thing to add [...]]]></description>
			<content:encoded><![CDATA[<p>
Like many other java developers, I am currently using Spring and<br />
Hibernate, so I can't attest to the quality of RIFE. But I thought this<br />
was interesting: This is a <a href="http://weblog.rubyonrails.com/archives/2005/03/19/bla-bla-list-cloning-a-rails-app-in-rife/">side-by-side<br />
comparison</a> of the RIFE source vs. the Rails source for the<br />
same feature (<a href="http://www.tadalist.com/">Ta-da list</a><br />
vs <a href="http://www.blablalist.com/">Bla bla list</a>).<br />
Just another thing to add to the ever-growing list of things to check<br />
out.</p>
<p>Note that I don't have an opinion on this because I don't know both<br />
toolsets (and like many others I don't sound very smart when comparing<br />
something I know vs something I don't know). <img src='http://www.hackerdude.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackerdude.com/2005/12/06/rife-vs-rails-side-by-side/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I missed Mixins in Java today</title>
		<link>http://www.hackerdude.com/2005/11/28/i-missed-mixins-in-java-today/</link>
		<comments>http://www.hackerdude.com/2005/11/28/i-missed-mixins-in-java-today/#comments</comments>
		<pubDate>Mon, 28 Nov 2005 23:54:47 +0000</pubDate>
		<dc:creator>David Martinez</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.hackerdude.com/?p=430</guid>
		<description><![CDATA[Note to Sun: I missed being able to do mixins with Java today. Maybe it's all this playing with Rails, but back in Java-land I had this particular problem and I thought - mixins would solve this. But no go. Not even with JDK 1.5. I guess I'll just put on my monkey coder hat [...]]]></description>
			<content:encoded><![CDATA[<p>Note to <strong>Sun</strong>: I missed <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=132988">being able to do mixins</a> with Java today. Maybe it's all this playing with Rails, but back in Java-land I had this particular problem and I thought - mixins would solve this. But no go. Not even with JDK 1.5.</p>
<p>I guess I'll just put on my monkey coder hat and add decorator scaffolding and almost-identical configuration code for 50 different classes instead. Maybe I should switch back to Spring autowire (like he Rails folks say, value convention more than configuration, right?). <img src='http://www.hackerdude.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' />  </p>
<p>Yes, I know that you <a href="http://csis.pace.edu/~bergin/patterns/multipleinheritance.html">can do it using interfaces</a>, but it still leaves me changing more than one line in all 50 classes. I also know that you could use some fancy AOP or dynamic proxying, and go against the <a href="http://www.c2.com/cgi/wiki?GrainOfTheLanguage">GrainOfTheLanguage</a> and end up with something that "works", but it's a pain to run through the debugger and determine basic intent.</p>
<p><b>*Sigh*</b></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackerdude.com/2005/11/28/i-missed-mixins-in-java-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rip UML straight out of java</title>
		<link>http://www.hackerdude.com/2005/11/23/rip-uml-straight-out-of-java/</link>
		<comments>http://www.hackerdude.com/2005/11/23/rip-uml-straight-out-of-java/#comments</comments>
		<pubDate>Wed, 23 Nov 2005 21:02:28 +0000</pubDate>
		<dc:creator>David Martinez</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.hackerdude.com/?p=426</guid>
		<description><![CDATA[I've been playing with the idea of taking the UML straight out of java, so I can do multiplatform UML Sketching using basically plaintext . So I went and downloaded UMLGraph and incorporated it into the my build system. So far I like it, but I have a couple of thoughts on it. It would [...]]]></description>
			<content:encoded><![CDATA[<p>I've been playing with the idea of taking the UML straight out of java, so I can do multiplatform <a href="http://www.martinfowler.com/bliki/UmlSketchingTools.html">UML Sketching</a> using basically plaintext .</p>
<p>So I went and downloaded <a href="http://www.spinellis.gr/sw/umlgraph/">UMLGraph</a> and incorporated it into the my build system.</p>
<p>So far I like it, but I have a couple of thoughts on it.</p>
<p><span id="more-426"></span></p>
<ul>
<li>It would be nice if it allowed for translating accesors into attributes. For example, a piece of code such as:<br />
<code lang="java"><br />
public void setFirstName(String firstName);<br />
public String getFirstName();<br />
</code></p>
<p>Should be modeled as a single "firstName" attribute. This should be configurable per class. This is specially important if you use DAO a lot. I think it's important to know at a glance if there are extra "operations" other than basic field access.
</li>
<li>I haven't tried very hard yet, but from the docs it is not obvious how to create a sequence diagram. It mentions the syntax, but where do you put this text? In the comments of the file? In a new file? What's the extension it expects? Will it scan for it automatically or do I need to call the command line in a special way? Sequence diagrams feel a bit like an afterthought. Maybe I'll feel different once I get one to work. <img src='http://www.hackerdude.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </li>
<li>UMLGraph seems to create one (1) diagram per invocation. I had to write an ant task that called another ant task for each of the packages I wanted to generate a graph for. It would be nice if it tghere was an option for "one graph/page per package" or something like that. Calling it with all your source gives you a giant diagram that really stresses the Windows Picture Viewer. <img src='http://www.hackerdude.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Apparently Maven's <a href="http://maven-plugins.sourceforge.net/maven-dotuml-plugin/index.html">DotUML Plugin</a> uses UMLGraph and supports this feature by setting the property maven.dotuml.singlepackage to false.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.hackerdude.com/2005/11/23/rip-uml-straight-out-of-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Jobs API and asyncExec</title>
		<link>http://www.hackerdude.com/2005/11/17/jobsapiasyncexec/</link>
		<comments>http://www.hackerdude.com/2005/11/17/jobsapiasyncexec/#comments</comments>
		<pubDate>Fri, 18 Nov 2005 00:09:45 +0000</pubDate>
		<dc:creator>David Martinez</dc:creator>
				<category><![CDATA[CBBTR]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.hackerdude.com/?p=419</guid>
		<description><![CDATA[Using the Jobs API (Job and IProgressMonitor) you can implement code that will run in a thread and update the standard Eclipse progress monitoring service as you go along in your thread. To create a job, extend from org.eclipse.core.runtime.Job and implement the run method: &#160; &#160; protected IStatus run&#40;IProgressMonitor monitor&#41; &#123; int steps = 100000; [...]]]></description>
			<content:encoded><![CDATA[<p>Using the Jobs API (Job and IProgressMonitor) you can implement code that will run in a thread and update the standard Eclipse progress monitoring service as you go along in your thread.</p>
<p>To create a job, extend from org.eclipse.core.runtime.Job and implement the run method:</p>
<pre class="java">&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">protected</span> IStatus run<span style="color: #66cc66;">&#40;</span>IProgressMonitor monitor<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #993333;">int</span> steps = <span style="color: #cc66cc;">100000</span>;
  monitor.<span style="color: #006600;">beginTask</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;My Task&quot;</span>, steps<span style="color: #66cc66;">&#41;</span>;
  <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #993333;">int</span> i=<span style="color: #cc66cc;">0</span>; i&lt;steps ; i++ <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    monitor.<span style="color: #006600;">subTask</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Step &quot;</span>+i<span style="color: #66cc66;">&#41;</span>;
    monitor.<span style="color: #006600;">worked</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> monitor.<span style="color: #006600;">isCanceled</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">break</span>;
  <span style="color: #66cc66;">&#125;</span>
  inputForTableViewer = <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AArrays+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Arrays</span></a>.<span style="color: #006600;">asList</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">String</span></a><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #ff0000;">&quot;One&quot;</span>,
             <span style="color: #ff0000;">&quot;Two&quot;</span>, <span style="color: #ff0000;">&quot;Three&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">return</span> Status.<span style="color: #006600;">OK_STATUS</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>To activate the job in MyClass (say it's a page with a tableViewer which we use to set the input), you do the following:</p>
<pre class="java">&nbsp;
MySampleJob myJob = <span style="color: #000000; font-weight: bold;">new</span> MySampleJob<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
myJob .<span style="color: #006600;">addJobChangeListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> JobChangeAdapter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> done<span style="color: #66cc66;">&#40;</span>IJobChangeEvent event<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    Display.<span style="color: #006600;">getDefault</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">asyncExec</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ARunnable+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Runnable</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> run<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        MyClass.<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">tableViewer</span>.
                        <span style="color: #006600;">setInput</span><span style="color: #66cc66;">&#40;</span>myJob .<span style="color: #006600;">getInputForTableViewer</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
      <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
myJob.<span style="color: #006600;">schedule</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>Have fun!</steps></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.hackerdude.com/2005/11/17/jobsapiasyncexec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
