<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-4133036378510199203</atom:id><lastBuildDate>Mon, 23 Jan 2012 06:28:34 +0000</lastBuildDate><category>java7</category><category>javafx</category><category>Microsoft</category><category>scala</category><category>Oracle/Apache Impasse</category><category>humor java javafx</category><category>Sun/Oracle</category><category>howto</category><category>VirtualBox</category><category>.Net</category><category>Open Source Advocacy</category><category>fanboys of the world unite</category><category>Clojure</category><category>Apple</category><category>Java</category><category>misc</category><category>patents</category><category>humour opinion</category><category>iPhone</category><category>groovy</category><category>Ruby</category><category>Linux</category><category>iPad</category><category>Android</category><category>humor</category><category>java scala groovy ruby clojure</category><title>Dot Neverland</title><description>Ooh! lookie here, yet another tech blog...</description><link>http://dotneverland.blogspot.com/</link><managingEditor>noreply@blogger.com (julian_za)</managingEditor><generator>Blogger</generator><openSearch:totalResults>65</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/DotNeverland" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="dotneverland" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-7317970168834122586</guid><pubDate>Sat, 14 Jan 2012 15:06:00 +0000</pubDate><atom:updated>2012-01-14T07:06:39.666-08:00</atom:updated><title>Documentation that is useful</title><description>I was reading this &lt;a href="http://www.infoworld.com/d/application-development/how-get-developers-document-their-code-183908"&gt;article&lt;/a&gt; by Neil Mcallister on his Fatal Exception blog entitled "How to get developers to document their code".&lt;br /&gt;
&lt;br /&gt;
Now it begs the question: What documentation is actually useful?&lt;br /&gt;
&lt;br /&gt;
Well, like all things in general I don't think it's a simple answer, best I could say is; what works well in your context.&lt;br /&gt;
&lt;br /&gt;
In my personal context as a developer of information systems for commercial entities I personally find&amp;nbsp; the following useful when it comes to documentation:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;A decent setup and getting started guide: where to get the code, what tools and frameworks I need, how to build and configure it, and how to get it up and running.&lt;/li&gt;
&lt;li&gt;Environmental information regarding the various environments: How the development, testing, QA and production environments are accessed, configured and managed.&lt;/li&gt;
&lt;li&gt;A High level guide to how the components of the software fit together, with a one liner about what each component does.&lt;/li&gt;
&lt;li&gt;An High level ERD or any other high level domain model is also quite useful.&lt;/li&gt;
&lt;/ul&gt;Most of this documentation is really there to give context about the code, the rest I can figure out from the code itself.&lt;br /&gt;
&lt;br /&gt;
I also have a list of documentation that I think is a waste of time and effort:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt; The above compiled into a document and then sent to die in something like Sharepoint: Useful documentation is easily searchable, easily accessible and easy to update referencing the actual models being used by architects and developers.&lt;/li&gt;
&lt;li&gt;Low level code documentation: It always out of date and rarely ever reflects the truth of the implementation to begin with (It's also annoying to read, Sequence diagrams come to mind). The only time documentation like this is useful is when the documentation effectively becomes the code (using MDA for example).&lt;/li&gt;
&lt;li&gt;Documentation done for the sake of process: No one will ever read this documentation except for the person who has to check that process is being followed. This seems to happen a lot in Waterfall environments where the process becomes so slow that organizations end up short circuiting pieces of the process in order to speed up development times. &lt;/li&gt;
&lt;/ul&gt;What do you consider useful in your context?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-7317970168834122586?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2012/01/documentation-that-is-useful.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-4991242859779675215</guid><pubDate>Sun, 17 Jul 2011 18:16:00 +0000</pubDate><atom:updated>2011-07-17T11:16:43.825-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">java7</category><title>Java 8.0 Wishlist (Take 2)</title><description>Ok so it's it been a while since my last article on &lt;a href="http://dotneverland.blogspot.com/2011/04/java-80-wishlist.html"&gt;this topic&lt;/a&gt;...&lt;br /&gt;
&lt;br /&gt;
The comments of course have been first rate, with opinions on the&amp;nbsp;wish-list&amp;nbsp;have ranged from outright agreement to threats of violence for even having such boneheaded ideas.&lt;br /&gt;
&lt;br /&gt;
It's all good of course, the thing that I love about the Java community is that we take the ideas and actually question them. Something I felt the .Net world could do more with.&lt;br /&gt;
&lt;br /&gt;
But anyway It's worth going through the list and giving a little rationale and meat on the wish-list, specifically on those that seemed to generate a lot of comments, so here goes...&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Properties.&lt;/b&gt;&lt;br /&gt;
Now I'm going to debate the OO nature of properties. Fact is that - for better or for worse - JavaBean style properties have become baked into Java and it's frameworks. So why not at the bare minimum tell the compiler you want to generate getter and setter methods with syntax sugar. And yes IDE's generate this for you, but I'd still prefer for the sake of brevity get rid of code that does stuff all.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Operator Overloading.&lt;/b&gt;&lt;br /&gt;
Easily the most contentious point. However let me give you my background: I recently did a lot of work doing monetary calculations. which &amp;nbsp;defined in an Excel spreadsheet by an Actuary. The only way I could get Java code to match the excel spreadsheet was to use ye olde BigDecimal. The code that came out is painful to say the least, mostly due to the lack of operators. Now BigDecimal is on the operator overloading todo list for Oracle, however it's painful having to wait, and the fact is that it's hard to build very expressive arithmetic types in Java.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Alternative deployment formats besides the JVM and &amp;nbsp;a classpath.&lt;/b&gt;&lt;br /&gt;
Ok this one seemed poorly presented. Basically I want to be able to compile a set of Java classes down into a native executable and deploy that. Even if all the executable does is wrap the classes together with a JVM. You ask why; that's easy I want to run Java apps on iOS.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Parameter names in method calls.&lt;/b&gt;&lt;br /&gt;
Ok so lets assume I have a method as follows:&lt;br /&gt;
&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;public void crappyGFXtask(int startx, int starty, int secondx, int secondy, int lastx, int lasty)
&lt;/code&gt;&lt;/pre&gt;I dare you write the code to call it, leave it for a few days and then go back to it, and see if you can make sense of the parameters. Named parameters simply give you ability to map the parameter names to values ala Objective-C so your call to the method would look something along the lines of:&lt;br /&gt;
&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;crappyGFXtask(startx:10, starty:11, secondx:25, secondy:40, lastx:myVariable, lasty:myVariable)
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Proxies on Abstract classes.&lt;/b&gt;&lt;br /&gt;
Yes Spring does this already, but guess what: I don't use Spring in every Java project I do (yes pigs are flying). It's a generally useful feature and JDK support would be sweet.&lt;br /&gt;
&lt;br /&gt;
Ok hope that clarifies things.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-4991242859779675215?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2011/07/java-80-wishlist-take-2.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-1969813193088176438</guid><pubDate>Tue, 26 Apr 2011 20:43:00 +0000</pubDate><atom:updated>2011-04-26T13:43:14.857-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><title>Java 8.0 Wishlist</title><description>With Java 7 almost out the door talk has now shifted to Java 8 and of course it's the perfect time for me to add my own $0.02 on my own wishlist.&lt;br /&gt;
&lt;br /&gt;
Properties.&lt;br /&gt;
Dunno what you can do here without annoying a few people. However I'd happily settle for some type of shorthand notation for getters and setters.&lt;br /&gt;
&lt;br /&gt;
Operator overloading.&lt;br /&gt;
This one pops up at just about every Java release. Now it seems that there are plans in the works to add indexers to collections and such like. Quite frankly if you're gonna do that, why not add a full complement of fixed operator overloadings, maybe taking some ideas from how Groovy&amp;nbsp;&lt;a href="http://groovy.codehaus.org/Operator+Overloading"&gt;does it&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Alternative deployment formats besides the JVM and a class path.&lt;br /&gt;
When you have to do one of those client Java applications that everyone claims nobody does, the Java deployment model really bites: Basically I want to create a fully contained application for a target platform. Now if all this contained application does at the end of the day is bootstrap a JVM together with a classpath who cares. It's also worth pointing out that this would allow Java applications to run quite easily on iOS, that is; if someone takes the time to do the port.&lt;br /&gt;
&lt;br /&gt;
Parameter names in method calls.&lt;br /&gt;
Nice to have, but it would make DSLs in java nicer.&lt;br /&gt;
&lt;br /&gt;
Finish Autoboxing.&lt;br /&gt;
I still can't do &lt;i&gt;1.toString().&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Proxies on Abstract Classes.&lt;br /&gt;
Not sure about the technical constraints on this, but it would be great if you could also create proxies on abstract classes and not just on interfaces.&lt;br /&gt;
&lt;br /&gt;
Make JavaFX useful.&lt;br /&gt;
Ok so JavaFX is not actually part of the JDK. Whatever the case, it's Oracle's chance to make client side Java really slick.&lt;br /&gt;
&lt;br /&gt;
Well that's my list for now...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-1969813193088176438?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2011/04/java-80-wishlist.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-1109519889428242230</guid><pubDate>Fri, 18 Feb 2011 16:54:00 +0000</pubDate><atom:updated>2011-02-18T09:30:34.088-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">howto</category><title>Using Google Contracts for Java with IntelliJ IDEA.</title><description>&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" &gt;The first step after obtaining the &lt;a href="http://code.google.com/p/cofoja/"&gt;Google Contracts for Java&lt;/a&gt; &lt;a href="http://www.huoc.org/~minh/cofoja/"&gt;Jar&lt;/a&gt; and adding it to your project, is to enable Annotation processing support in IDEA.&lt;/span&gt; &lt;/span&gt;&lt;p class="p1"&gt;&lt;span class="Apple-style-span"  &gt;To do this go to open the &lt;i&gt;Settings &lt;/i&gt;window (&lt;i&gt;IntelliJ IDEA &gt; preferences&lt;/i&gt; on Mac) and go to &lt;i&gt;Compiler &gt; Annotation Processors&lt;/i&gt;.&lt;/span&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="Apple-style-span"  &gt;Now do the following steps:&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;/p&gt;&lt;span class="Apple-style-span" style="font-family: arial; " &gt;&lt;ul&gt;&lt;li&gt;Check the Enable Annotation processing option.&lt;/li&gt;&lt;li&gt;Select the Obtain processors from project classpath option.&lt;/li&gt;&lt;li&gt;In the Processed Modules table click the Add button and select the Module for which you want to enable Contracts for.&lt;/li&gt;&lt;li&gt;Hit Apply and you are ready to rock.&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-vi82guRFyw0/TV6n6ucKCLI/AAAAAAAAAD0/AFMwy6kEkVE/s1600/Screen%2Bshot%2B2011-02-18%2Bat%2B7.10.01%2BPM.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 278px;" src="http://1.bp.blogspot.com/-vi82guRFyw0/TV6n6ucKCLI/AAAAAAAAAD0/AFMwy6kEkVE/s400/Screen%2Bshot%2B2011-02-18%2Bat%2B7.10.01%2BPM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5575078016071633074" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="Apple-style-span"  &gt;To test this you can add a basic contract annotation to a method in a class, here is one that I created using the &lt;b&gt;&lt;i&gt;@Requires&lt;/i&gt;&lt;/b&gt; annotation to ensure that the integer method parameter "c" has a value greater than zero:&lt;/span&gt;&lt;/p&gt;&lt;pre style="font-family: 'Andale Mono', 'Lucida Console', Monaco, fixed, monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(153, 153, 153); border-right-color: rgb(153, 153, 153); border-bottom-color: rgb(153, 153, 153); border-left-color: rgb(153, 153, 153); line-height: 14px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; overflow-x: auto; overflow-y: auto; width: 100%; "&gt;&lt;code&gt;&lt;span class="Apple-style-span" &gt;import com.google.java.contract.Requires;&lt;br /&gt;&lt;br /&gt;public class TestSomeContracts {&lt;br /&gt;&lt;br /&gt;@Requires({"c &gt; 0"})&lt;br /&gt;public void testContract(int c) {&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="Apple-style-span"  &gt;Now when you compile you wont get much feedback as to wether the annotation was processed or not, as the contract syntax is correct, so lets modify it a bit to generate a compile splat by changing the variable name of the precondition:&lt;/span&gt;&lt;/p&gt;&lt;pre style="font-family: 'Andale Mono', 'Lucida Console', Monaco, fixed, monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(153, 153, 153); border-right-color: rgb(153, 153, 153); border-bottom-color: rgb(153, 153, 153); border-left-color: rgb(153, 153, 153); line-height: 14px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; overflow-x: auto; overflow-y: auto; width: 100%; "&gt;&lt;code&gt;&lt;span class="Apple-style-span" &gt;@Requires({"cs &gt; 0"})&lt;br /&gt;public void testContract(int c) {&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="Apple-style-span"  &gt;When you build the module, you will now get a compilation failure which kinda integrates into IDEA, in that you can click on the error in the messages window and it will take you to the line that failed. Unfortunately IDEA wont highlight the line in your Editor or anything fancy like what you get in Eclipse, but it's good enough to work with.&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="Apple-style-span" &gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-V3ejQnWowqU/TV6piywKIYI/AAAAAAAAAEE/MADyQk7neSI/s1600/Screen%2Bshot%2B2011-02-18%2Bat%2B7.17.36%2BPM.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 86px;" src="http://2.bp.blogspot.com/-V3ejQnWowqU/TV6piywKIYI/AAAAAAAAAEE/MADyQk7neSI/s400/Screen%2Bshot%2B2011-02-18%2Bat%2B7.17.36%2BPM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5575079803935662466" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="p2"&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  &gt;Using a class with contracts.&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="Apple-style-span"  &gt;After reverting and compiling the class I created a simple test case to test the contract by passing in data that violates the contract (ie. an integer less than 1):&lt;/span&gt;&lt;/p&gt;&lt;pre style="font-family: 'Andale Mono', 'Lucida Console', Monaco, fixed, monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(153, 153, 153); border-right-color: rgb(153, 153, 153); border-bottom-color: rgb(153, 153, 153); border-left-color: rgb(153, 153, 153); line-height: 14px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; overflow-x: auto; overflow-y: auto; width: 100%; "&gt;&lt;code&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;import org.junit.Test;&lt;br /&gt;&lt;br /&gt;public class TestSomeContractsTest {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;@Test&lt;br /&gt;public void testContract() {&lt;br /&gt;  new TestSomeContracts().testContract(-1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="Apple-style-span" &gt;I&lt;span class="Apple-style-span" &gt; run the test… and... it passes!&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="Apple-style-span"  &gt;In order to actually work, Google Contracts needs to do some bytecode shenanigans in order to actually enforce the contract definitions during runtime. Currently they have two modes of operation, an offline instrumenter which is a post compilation processor which weaves in the contracts into a compiled class, and a java agent.&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="Apple-style-span"  &gt;For development the most convenient method to use is the java agent.&lt;/span&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="Apple-style-span"  &gt;To use the agent in IDEA, click the &lt;i&gt;Select Run/Debug Settings&lt;/i&gt; drop down and select the &lt;i&gt;Edit configurations&lt;/i&gt; option. Expand the &lt;i&gt;defaults&lt;/i&gt; entry and select the &lt;i&gt;JUnit&lt;/i&gt; option (or &lt;i&gt;TestNG&lt;/i&gt; or just plain &lt;i&gt;Application&lt;/i&gt;) and add the following to the &lt;i&gt;VM parameters&lt;/i&gt; field:&lt;/span&gt;&lt;/p&gt;&lt;p class="p1" style="text-align: center;"&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span"  &gt;          -javaagent:[path to the Google Contracts for Java jar file]&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="Apple-style-span"  &gt;I Also remove an existing configuration so that it picks up the new option when I run the test again.&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="Apple-style-span" &gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-aTn5kJxTNmY/TV6oZXoXI0I/AAAAAAAAAD8/W1rtAhnXvXs/s1600/Screen%2Bshot%2B2011-02-18%2Bat%2B7.12.40%2BPM.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 331px;" src="http://1.bp.blogspot.com/-aTn5kJxTNmY/TV6oZXoXI0I/AAAAAAAAAD8/W1rtAhnXvXs/s400/Screen%2Bshot%2B2011-02-18%2Bat%2B7.12.40%2BPM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5575078542524752706" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="Apple-style-span"  &gt;Now I run the test again and - voila - nice big splat when I run the test and pass invalid data to the method:&lt;/span&gt;&lt;/p&gt;&lt;pre style="font-family: 'Andale Mono', 'Lucida Console', Monaco, fixed, monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(153, 153, 153); border-right-color: rgb(153, 153, 153); border-bottom-color: rgb(153, 153, 153); border-left-color: rgb(153, 153, 153); line-height: 14px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; overflow-x: auto; overflow-y: auto; width: 100%; "&gt;&lt;code&gt;&lt;span class="Apple-style-span" &gt;com.google.java.contract.PreconditionError: c &amp;gt; 0&lt;br /&gt;at TestSomeContracts.com$google$java$contract$PH$TestSomeContracts$testContract(TestSomeContracts.java:9)&lt;br /&gt;at TestSomeContracts.testContract(TestSomeContracts.java)&lt;br /&gt;at TestSomeContractsTest.testContract(TestSomeContractsTest.java:9)&lt;br /&gt;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;br /&gt;at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)&lt;br /&gt;at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)&lt;br /&gt;at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)&lt;br /&gt;at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)&lt;br /&gt;at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)&lt;br /&gt;at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)&lt;br /&gt;at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)&lt;br /&gt;at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)&lt;br /&gt;at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)&lt;br /&gt;at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)&lt;br /&gt;at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)&lt;br /&gt;at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)&lt;br /&gt;at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)&lt;br /&gt;at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)&lt;br /&gt;at org.junit.runners.ParentRunner.run(ParentRunner.java:236)&lt;br /&gt;at org.junit.runner.JUnitCore.run(JUnitCore.java:157)&lt;br /&gt;at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt; &lt;p class="p1"&gt;&lt;span class="Apple-style-span"  &gt;On a final note. Google contracts is still pretty fresh, so here's hoping IDE support will improve if the project takes off. I must also say that I'm not too fond of the current mechanisms for enforcing the contract. Hopefully Google might take a page from Lombok and do to weaving at compile time.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-1109519889428242230?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2011/02/using-google-contracts-for-java-with.html</link><author>noreply@blogger.com (julian_za)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-vi82guRFyw0/TV6n6ucKCLI/AAAAAAAAAD0/AFMwy6kEkVE/s72-c/Screen%2Bshot%2B2011-02-18%2Bat%2B7.10.01%2BPM.png" height="72" width="72" /><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-3247537090326893020</guid><pubDate>Tue, 26 Oct 2010 08:17:00 +0000</pubDate><atom:updated>2010-10-26T01:34:18.563-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Linux</category><title>Does Java need a "Linux moment"?</title><description>Does anyone remember that one of the reasons Linux or GNU/Linux (sorry Richard Stallman) was created, was to create a  Unix like environment which was free and open to use and not encumbered by the licensing restrictions of the AT&amp;amp;T's original Unix.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;With all the &lt;a href="http://www.jroller.com/scolebourne/entry/babylon_5_the_great_war"&gt;stuff&lt;/a&gt; happening with Java right now, being a Java developer has become a depressing experience, and it's getting really hard to see a positives for the platform.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Perhaps Java needs it's own "Linux moment". &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A Java (but not Java) platform that is free and open and built on the same principles that made Linux a success, with the potential for the same type of success that Linux has enjoyed.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I don't know if it's even feasible, but it's certainly becoming an appealing thought.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-3247537090326893020?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/10/does-java-need-linux-moment.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-3000122295097467475</guid><pubDate>Thu, 07 Oct 2010 06:55:00 +0000</pubDate><atom:updated>2010-10-06T23:58:12.110-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">patents</category><category domain="http://www.blogger.com/atom/ns#">humor</category><title>Solving the software patent issue: The Software patent clearing house</title><description>&lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Motorola is suing Apple for infringing 18 of it's patents in it's phones and computers. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Apple is suing HTC for infringing it's patents.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Microsoft is suing Motorola for infringing its patents.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Nokia is also suing Apple, to which Apple countersued Nokia, all of course for patent infringements.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Lets not forget Oracle who is suing Google for infringing Java patents.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Now Microsoft is about to release it's Windows phone 7, and they've had to do quite a bit of catchup so it's quite possible they might have "infringed" on some vague and obscure software patent. So it wouldn't surprise me if - in order to complete the circle of litigation - either an Apple or a Google type company sues Microsoft on or about the release date of Windows 7.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;It strikes me that all this circular ligation is forcing companies to spend an awful lot of money on lawyers who seem to be the only ones benefitting.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;To remedy this situation I recommend that it's time for a &lt;b&gt;Software patent clearing house&lt;/b&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Now what exactly would a Software patent clearing house do?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Basically it would be an organisation which has a central repository of all software patents. Whenever a company launches a software patent infringement suite against another company they would submit this suite to this organisation.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Since it's most likely that the company being sued would probably countersue with it's own patent infringement suite, The Software patent clearing house would be responsible for vetting and offsetting the patents of the first suite with the patents of the counter suite, and the only the company with a positive amount of patents left would be able to continue litigation.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;To illustrate: Let say company A sues company B for infringement of six of it's software patents. Company B could then countersue company A for infringement of four of it's patents. The clearing house would then subtract company B's claims from company A's claims, leaving Company A with two patent infringements it can litigate for.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;The clearing house could also provide a key additional service:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;You could do data mining on the patent information and create a &lt;b&gt;litigation index&lt;/b&gt; for companies which is basically a numerical value calculated to the perceived market value of the underlying patent. Companies with a low litigation index would have few patents while a company with many patents would have a high litigation index. Companies can then trade their litigation index points much like you could trade shares.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2"&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;For example company A might have a high index but have a few bad quarters. They could then sell off index points (and consequently the patents backing the index points) which other companies could then buy bringing in cash for Company A. Company B who bought some index points can then use this index points to offset any patent litigation they might encounter, so if Company B get's sued by Company C they can use the index points to reduce the scale of the litigation, for example if they are being sued for infringement on six patents, they could trade off index points to the suing company to reduce the suite to a mere one or two patents. Company B could then even use it's own patent set to nullify the suite completely.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; widows: 2; orphans: 2"&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="font-style: normal"&gt;&lt;span style="font-weight: normal"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;The price of the index points would be determined by the availability of index points on the market against the volume of litigation. No doubt this price would become one the standard indicators that you normally get from financial news services.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; widows: 2; orphans: 2"&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="font-style: normal"&gt;&lt;span style="font-weight: normal"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Furthermore Venture Capitalists could even buy index points up front, which would become a regular part of the the capital that they provide new startups.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; widows: 2; orphans: 2"&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="font-style: normal"&gt;&lt;span style="font-weight: normal"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Some companies might even have so many index points they could get out of the software altogether and start simply start trading these index points as a means of making money.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p align="LEFT" style="margin-bottom: 0cm; widows: 2; orphans: 2"&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="font-style: normal; "&gt;&lt;span style="font-weight: normal; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Of course the clearing house itself would need to charge fees in order to fund the operation, but think of what companies could save on legal fees, together with the allure of actually being able to earn cash of patents as opposed to getting into a major legal wrangling.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-3000122295097467475?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/10/solving-software-patent-issue-software.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-1229870901638405176</guid><pubDate>Mon, 27 Sep 2010 06:19:00 +0000</pubDate><atom:updated>2010-09-26T23:29:23.749-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Ruby</category><category domain="http://www.blogger.com/atom/ns#">Clojure</category><category domain="http://www.blogger.com/atom/ns#">groovy</category><category domain="http://www.blogger.com/atom/ns#">Sun/Oracle</category><category domain="http://www.blogger.com/atom/ns#">scala</category><title>The Next Big Java Language; my $0.02</title><description>&lt;p style="margin-bottom: 0cm"&gt;Time to to add my $0.02....&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;What is the &lt;b&gt;N&lt;/b&gt;ext &lt;b&gt;B&lt;/b&gt;ig &lt;b&gt;J&lt;/b&gt;VM &lt;b&gt;L&lt;/b&gt;anguage going to be?&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;I've been watching the whole evolution of alternative languages on the JVM for a few years now. Long enough to start tracing the hype around the different languages.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Yet none of these languages are really mainstream, despite their apparent advantages.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;I think the reason for this has absolutely nothing to do with the technical features (or lack thereof) of any of these languages.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;I think the NBJL will be the one that large organisation or group of organisations with enough clout and deep enough pockets is actually willing to go out and effectively market both to decision makers and developers.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;No doubt Java did strike a chord with mainstream developers, but quite honestly was that more to do with Sun's aggressive marketing campaign or because it of it's many technical merits?&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-1229870901638405176?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/09/next-big-java-language-my-002.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-4880847237551242551</guid><pubDate>Mon, 23 Aug 2010 08:29:00 +0000</pubDate><atom:updated>2010-08-23T01:30:30.332-07:00</atom:updated><title>Quote of the Day</title><description>Quote of the Day:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;"In the end, any program must manipulate state.        A program that has no side effects whatsoever is a kind of black box.        All you can tell is that the box gets hotter."&lt;br /&gt;  &lt;br /&gt;            - Simon Peyton-Jones; Co-creator of the Haskell programming language.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-4880847237551242551?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/08/quote-of-day.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-4348519257339297973</guid><pubDate>Sun, 15 Aug 2010 04:46:00 +0000</pubDate><atom:updated>2010-08-14T23:20:58.180-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">.Net</category><title>Why Java is more open than .Net</title><description>First of all, lets clarify a few things: Open does not necessarily mean free, and indeed Open Source, secondly in saying that Java is open, I also don't mean that it couldn't be more open than it already is and that the current processes don't have some painful problems regarding openness.&lt;br /&gt;&lt;br /&gt;With that out of the way, why is Java more open than .Net?&lt;br /&gt;&lt;br /&gt;Lets start with a Simple question: Can anyone show me a .Net 3.5 (Never mind .Net 4.0) &lt;span style="font-weight: bold; font-style: italic;"&gt;certified&lt;/span&gt; implementation, that also has &lt;span style="font-weight: bold; font-style: italic;"&gt;certified&lt;/span&gt; implementations of &lt;span style="font-weight: bold; font-style: italic;"&gt;all&lt;/span&gt; the important .Net technologies that actually make .Net useful  like WCF, WPF, WWF, WIF etc, etc. so that I can take my .Net 3.5 App written on Microsoft's .Net implementation and dump it unchanged onto this implementation onto - say Solaris - and it will run no problem regardless of what frameworks and features of those framework I used?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;While you are looking it up, here are some more questions:&lt;br /&gt;&lt;br /&gt;&lt;li&gt;How do go about (or can I even) license .Net from Microsoft?&lt;/li&gt;&lt;br /&gt;&lt;li&gt;How do I get a say in the specifications for new or existing .Net technologies?&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Can I actually get my .Net implementation and appropriate frameworks rubber stamped by some certification authority?&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Does .Net have some type of philosophy regarding platform neutrality?&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;Here are the answers to those questions from a Java perspective:&lt;br /&gt;&lt;br /&gt;&lt;li&gt;I go to Oracle apply for a Java License, pony up some cash, agree to some terms, then I get a nice kit from Oracle and go forth an implement.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;I join the Java Community Process and give input to the various Java Specification Requests, I can even submit new Java Specification Requests.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;I run my implementation of a Java Specification Request against the Technology compatibility kit for that Java Specification Request and not I can say my implementation is certified.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Java has had the concept of Write Once Run Anywhere from the beginning and it's backed into Java and the JCP.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;So what does this mean, and why does it make Java more open?&lt;br /&gt;&lt;br /&gt;It means; that as an end user of Java I can pick and choose the best Java implementations around, and if I decide that I want to change the underlying platform or even the implementation I can do so with relatively little fuss.&lt;br /&gt;&lt;br /&gt;I have in the past run the same Java program happily on OSX, Windows, AIX on Solaris running on Intel, PowerPC and Sparc respectively.&lt;br /&gt;&lt;br /&gt;I have also developed on JBoss and deployed on Glassfish.&lt;br /&gt;&lt;br /&gt;In other words; &lt;span style="font-weight: bold; font-style: italic;"&gt;I as an end user am not locked into any specific Java provider&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;But what about &lt;span style="font-weight: bold;"&gt;Mono&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;Ecma&lt;/span&gt;?.&lt;br /&gt;&lt;br /&gt;Yes the CLR (and I think C# as well) is an Ecma standard which Java is not.&lt;br /&gt;&lt;br /&gt;But the CLR and C# alone maketh not a development platform and the stuff that makes .Net useful is not very open at all, and as much a &lt;a style="font-weight: bold; font-style: italic;" href="http://tirania.org/blog/archive/2010/Aug-13.html"&gt;The Mono community likes to play it down&lt;/a&gt; a &lt;a style="font-weight: bold; font-style: italic;" href="http://blogs.computerworlduk.com/open-enterprise/2010/07/richard-stallman-on-net-mono-and-dotgnu/index.htm"&gt;cloud still hangs over Mono regarding patents&lt;/a&gt;. (BTW: If any Mono guys  ever read this, it's fair to say that Mono hasn't cost Microsoft a lot so far, if Android where to run Mono, the cost to Microsoft might be in the billions, can you guarantee Microsoft's behavior when it's losing market share and money?)&lt;br /&gt;&lt;br /&gt;Things may of course change, Microsoft may actually put forward a formal licensing program, and together with the ECMA standardization, and then when I can run &lt;span style="font-weight: bold;"&gt;all&lt;/span&gt; of .Net anywhere on any implementation, then I can say .Net is more open than Java.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-4348519257339297973?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/08/why-java-is-more-open-than-net.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-7447634739078559729</guid><pubDate>Fri, 30 Jul 2010 06:12:00 +0000</pubDate><atom:updated>2010-07-29T23:52:43.324-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Apple</category><category domain="http://www.blogger.com/atom/ns#">Microsoft</category><title>Steve Jobs vs Steve Ballmer.</title><description>Ok, this time I really promise that this is the last I write about Apple for a while...&lt;br /&gt;&lt;br /&gt;This time however I'm going to compare Steve Jobs and Steve Ballmer via the magic of &lt;a style="font-style: italic; font-weight: bold;" href="http://www.youtube.com/"&gt;Youtube&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Firstly lets compare the two men think about the nature of what a computer should be:&lt;br /&gt;&lt;br /&gt;Here's &lt;a style="font-style: italic; font-weight: bold;" href="http://www.youtube.com/watch?v=ob_GX50Za6c&amp;amp;feature=related"&gt;Jobs,&lt;/a&gt; now here's &lt;a style="font-weight: bold; font-style: italic;" href="http://www.youtube.com/watch?v=VWkRgNTJZuM"&gt;Ballmer&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now before I continue, it would be easy to write Steve Ballmer off, however during his tenure, Microsoft has become the &lt;a style="font-weight: bold; font-style: italic;" href="http://www.eweek.com/c/a/Cloud-Computing/Cloud-Awakens-Microsofts-Server-and-Tools-Giant-855303/"&gt;most powerful technology company in the Enterprise&lt;/a&gt;. I daresay Ballmer's stoic approach to computing has allowed to see things in the black and white manner that Business customers understand.&lt;br /&gt;&lt;br /&gt;However is this a good thing. Does anyone remember how Microsoft got to the top? Bill Gates understood consumers, and that's how he drove Microsoft to the top. The question is does Ballmer &lt;a style="font-weight: bold; font-style: italic;" href="http://www.youtube.com/watch?v=dR8SAFRBmcU&amp;amp;feature=related"&gt;understand them.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now Steve Jobs is a character of note, and certainly not everbody's cup of tea. He's made some &lt;a style="font-weight: bold; font-style: italic;" href="http://www.youtube.com/watch?v=dR8SAFRBmcU&amp;amp;feature=related"&gt;nasty comments&lt;/a&gt; about Microsoft and actually seems &lt;a style="font-weight: bold; font-style: italic;" href="http://www.youtube.com/watch?v=uqVt81XmKxc"&gt;rather unfair&lt;/a&gt; if you ask me. But consider these interviews with Ballmer regarding Apple's &lt;a style="font-weight: bold; font-style: italic;" href="http://www.youtube.com/watch?v=BcUicfqelC8&amp;amp;feature=related"&gt;iPhone&lt;/a&gt;, &lt;a style="font-weight: bold; font-style: italic;" href="http://www.youtube.com/watch?v=NZIOhFmJ8r8&amp;amp;feature=related"&gt;AppStore&lt;/a&gt; and &lt;a style="font-weight: bold; font-style: italic;" href="http://www.youtube.com/watch?v=VWkRgNTJZuM"&gt;iPad&lt;/a&gt;, just as they launched and then read &lt;a style="font-weight: bold; font-style: italic;" href="http://www.theregister.co.uk/2010/07/29/ballmer_awake_at_night/"&gt;this&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-7447634739078559729?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/07/steve-jobs-vs-steve-ballmer.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-466767263163196997</guid><pubDate>Wed, 21 Jul 2010 18:27:00 +0000</pubDate><atom:updated>2010-07-22T05:51:34.875-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">iPad</category><category domain="http://www.blogger.com/atom/ns#">Android</category><category domain="http://www.blogger.com/atom/ns#">Microsoft</category><title>Android and the iPad makes Steve Ballmer quiver in his boots.</title><description>I wonder if Android and the iPad keeps Steve Ballmer awake at night.&lt;br /&gt;&lt;br /&gt;Why so?&lt;br /&gt;&lt;br /&gt;The iPad is &lt;a style="font-style: italic;" href="http://www.zdnet.com/blog/btl/apple-earnings-surge-jobs-says-amazing-new-products-still-on-tap/36959?tag=content;feature-roto"&gt;successful&lt;/a&gt;, not only as a consumer device but also as an &lt;a style="font-style: italic;" href="http://www.zdnet.com/blog/btl/apples-ipad-iphone-and-an-enterprise-halo-effect/36991?tag=content;feature-roto"&gt;enterprise&lt;/a&gt; device. If the results of the iPad are anything to go by, the Tablet is poised to be a very popular form factor.&lt;br /&gt;&lt;br /&gt;But the iPad is effectively just one device (albeit the first one) in this new emerging Tablet space. It seems the &lt;a style="font-style: italic;" href="http://www.google.com/search?q=Android+tablets&amp;amp;hl=en&amp;amp;prmd=nuisv&amp;amp;source=univ&amp;amp;tbs=nws:1&amp;amp;tbo=u&amp;amp;ei=tj5HTI7DHN6I4gav-qzZCQ&amp;amp;sa=X&amp;amp;oi=news_group&amp;amp;ct=title&amp;amp;resnum=1&amp;amp;ved=0CCoQsQQwAA"&gt;majority&lt;/a&gt; of these devices will be running Android, and none seem to be running Windows.&lt;br /&gt;&lt;br /&gt;Now consider this. Windows has risen to be the dominant enterprise operating system, despite of the fact that for most of it's existence the Windows platform has been inferior to the Unix/Linux/Mainframe platforms.&lt;br /&gt;&lt;br /&gt;Consider how first DOS then Windows started out purely on - what was then - the low end of the computing market; the Desktop, and gradually started moving into more and more sophisticated applications, with each version getting incrementally better until Windows Server 2008, which can be used quite safely for high end computing tasks.&lt;br /&gt;&lt;br /&gt;It was able to do this, partly thanks to Moore's law but more importantly by capitalizing on the familiarity of Windows by the people making the decisions, not to mention the shallow learning curve offered to people who had practically grown up with the OS.&lt;br /&gt;&lt;br /&gt;Windows is an example of a &lt;a style="font-style: italic;" href="http://en.wikipedia.org/wiki/Disruptive_technology"&gt;disruptive technology&lt;/a&gt;, clearly illustrating the fact that's it's often easier to drive a low end product into the high end, than a high end product into the low end thanks to mass appeal.&lt;br /&gt;&lt;br /&gt;Unfortunately Windows is no longer a low end product.&lt;br /&gt;&lt;br /&gt;Windows 7 is optimized for desktops, it's not really designed for Tablets and touch screens, and so far it hasn't really featured much on any of the upcoming Tablets.&lt;br /&gt;&lt;br /&gt;Now iPad aside basically every new Tablet is running Android, a low end operating system and based on the iPad's success; the Tablet is the new &lt;a style="font-style: italic;" href="http://en.wikipedia.org/wiki/Disruptive_technology"&gt;disruptive technology&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;So lets suppose for a minute that Android becomes the dominant Tablet OS, and that the Tablet becomes popular enough that at least most knowledge workers and decision makers have one.&lt;br /&gt;&lt;br /&gt;It's not inconceivable that those same knowledge workers and decision makers may easily decide to start using Android for other tasks, initially maybe for things like cheap Android powered terminals (even terminals calling Windows Apps via Citrix or Terminal services) for call center agents and then later for full desktop replacements.&lt;br /&gt;&lt;br /&gt;Now you may be thinking "Huh! Android is a mobile OS"  but consider that if it made the jump from a phone to a tablet, why couldn't it jump to a full desktop? I don't think many people envisaged Windows getting onto the server either.&lt;br /&gt;&lt;br /&gt;Of course this is just speculation, the only successful tablet so far is the iPad, and it's too early to say if any of the multitude of Android Tablets (most of which haven't even been released yet) will be as successful. Furthermore it's still early enough for Microsoft to develop a compelling product for the Tablet space.&lt;br /&gt;&lt;br /&gt;Microsoft - despite it's wide market range - Is dependent on it's desktop dominance. Steve Ballmer must be a very concerned man.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-466767263163196997?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/07/android-and-ipad-makes-steve-ballmer.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-8938532063376327308</guid><pubDate>Wed, 21 Jul 2010 18:06:00 +0000</pubDate><atom:updated>2010-07-21T11:22:29.807-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">VirtualBox</category><title>The power of simplicity.</title><description>Never underestimate the power of simplicity...&lt;br /&gt;&lt;br /&gt;I've been running my Windows environment for work purposes on a Virtual Machine.&lt;br /&gt;&lt;br /&gt;I started off on Virtual Box and decided after a little while that I wanted to see what more sophisticated virtualisation would be like.&lt;br /&gt;&lt;br /&gt;My first attempt was Parallels 5. Now Parallels offers fantastic Integration, for example it wraps all the running Windows processes and presents them as processes running in your environment, so you can switch to VM applications as if they were running inside your host OS.&lt;br /&gt;&lt;br /&gt;The only problem was that Parallels is dead slow. It managed to grind my quad core i5 Macbook Pro to a halt, not to mention all the daemons it runs messes around with the startup and shutdown of the Macbook itself.&lt;br /&gt;&lt;br /&gt;My next attempt was VMWare Fusion. Now VMWare is the Mercedes Benz of virtualisation products, and although it wasn't as fancy as Parallels, it worked very well, easily reading and importing my existing virtual disks, and running the VM with little fuss and overhead with all the integration I really needed, without dragging down the performance of my Macbook.&lt;br /&gt;&lt;br /&gt;Unfortunately, on day three of my VMWare experiment I tried to restart a paused VM and it crashed and would not let me restart the OS inside the VM, I tried to reimport the original VirtualBox VM but it would not let me.&lt;br /&gt;&lt;br /&gt;So now I'm back on VirtualBox. It's fast, simple and so far the only Virtualisation product I've been able to use with any success.&lt;br /&gt;&lt;br /&gt;Bottom line: Simple is best.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-8938532063376327308?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/07/power-of-simplicity.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-1215363588651161130</guid><pubDate>Tue, 13 Jul 2010 06:04:00 +0000</pubDate><atom:updated>2010-07-13T00:01:59.996-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Android</category><category domain="http://www.blogger.com/atom/ns#">Apple</category><title>Android vs Apple.</title><description>I don't think anyone who reads this blog will doubt the fact that I love Apple products. I write this blog entry on a Macbook Pro, I have an iPhone 3GS and before that I had the 3G which my wife is now very happy with.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I also like Android.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For me Android is best poised to become the commodity mobile platform for Phones and possibly for Tablets. It's going to become the DOS/Windows of the Mobile world.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I also like Android because of it's Open Source underpinnings and the Java roots of it's SDK.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;On top of that, I'm also a Google fan, I use Chrome and I'm watching the whole Google Wave thing with a lot of interest.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Furthermore besides the iPhone, I've looked at developing some Android apps (An activity that is unfortunately limited because Google doesn't offer paid for apps in my country)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I even attempted to try buy an Android phone earlier this year. And I honestly couldn't find one that I liked (although that is mostly due to the rather poor selection we have in our Country)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The thing about Apple is that they build a device for which the software and hardware is in unison from the ground up, coupled with arguably the worlds best user experience.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For example, take OSX. OSX is a great product on it's own, and technically you could run it on a standard beige Intel box. The question is would I want to.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;OSX is the best part of my Macbook, but the sheer niceness of my Macbook hardware is enough to not make me want to run OSX on anything else. I would miss things like the integrated light sensors, the useable track pad, the lighted keyboard, the magnetic charger. Not to mention the eye soothing looks of the Unibody design.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There is however a problem with Apple's approach.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Apple provides the only way to use it's own products. In other words it's a pure product as opposed to being a platform like Android or Windows.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can't build an "ecosystem" with Apple with new devices being used in new contexts, like embedding iOS into a robot or an industrial device like you could with Android.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;More importantly you will never be able to use Apple in a corporate for anything more than a niche group of users. The reason is quite simply that you can't run OSX on anything but Apple, and corporates don't like having thousands of desktops so tightly coupled to a single supplier.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As a result Apple is never going to be a monopoly in anything. A fact that is unfortunately baked into the way it does things.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I fully expect Android to product a market vastly larger and much more diverse than anything Apple could ever hope for.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I will even go so far as too say that Apple knows this and accepts it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So why am I writing this. Maybe because I don't like the fact that there is this belief in IT that for one platform to win the other has too lose. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It's the type of belief that allows monopolies to form and prosper.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-1215363588651161130?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/07/android-vs-apple.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-2958494089570688858</guid><pubDate>Fri, 25 Jun 2010 18:11:00 +0000</pubDate><atom:updated>2010-06-25T11:58:50.001-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">Sun/Oracle</category><title>Oracle and the Sun exodus</title><description>So Oracle has had quite a good quarter, with &lt;a href="http://www.businessweek.com/idg/2010-06-24/oracle-q4-profit-jumps-24-percent.html"&gt;profit jumping 24%&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;What makes this interesting, is that Oracle claimed that $400 million worth of profit came from the sale of Sun gear, which is quite interesting especially that before the sale Sun hadn't really been making money even in the good times.&lt;br /&gt;&lt;br /&gt;At the same time James Gosling is &lt;a href="http://www.theserverside.com/news/thread.tss?thread_id=60436"&gt;comforting &lt;/a&gt;the hordes of former Sun employees leaving Oracle.&lt;br /&gt;&lt;br /&gt;Quite honestly though, I think the whole exodus of Sun employees leaving is being overblown by the media.&lt;br /&gt;&lt;br /&gt;When you buy a company that is floundering like Sun was, you generally have to take drastic measures in order to bring that company back from brink, and drastic measures in the corporate world normally means doing lots of nasty things.&lt;br /&gt;&lt;br /&gt;Oracle has a reputation for being to integrate companies it purchases quite well, so it's therefore fair to say that they are pretty good at doing said nasty things.&lt;br /&gt;&lt;br /&gt;Now to take it a step further, Sun was not in a fantastic place when Oracle bought it, no doubt it needed some rather drastic measures to get things going again, so I can imagine Oracle had to do some &lt;em&gt;really nasty&lt;/em&gt; things.&lt;br /&gt;&lt;br /&gt;As a result you are going to get many people who leave, many of whom are good people who you don't want to lose, but it's unfortunately par for the course.&lt;br /&gt;&lt;br /&gt;To be totally honest It didn't even bother me when James Gosling left Oracle.&lt;br /&gt;&lt;br /&gt;Consider that he has pretty much had no publicly visible direct influence on core Java since it got handed over to the JCP which was 12 years ago.&lt;br /&gt;&lt;br /&gt;Now don't get me wrong, He's left a big hole in Java for Oracle, and I'm hoping that he stays involved in Java, heck, maybe now he can contribute more directly to Java and the community than he could while he was working for Sun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-2958494089570688858?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/06/oracle-and-sun-exodus.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-3853522450726768953</guid><pubDate>Fri, 11 Jun 2010 05:15:00 +0000</pubDate><atom:updated>2010-06-10T22:52:42.738-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Oracle/Apache Impasse</category><title>A question for Oracle and the Apache Software Foundation</title><description>Time for a Rant.&lt;br /&gt;&lt;br /&gt;It's been roughly six months since Oracle bought Sun. And while I know very little about these things I doubt that it's been enough time to absorb a company like Sun whose product portfolio was extensive to say the least.&lt;br /&gt;&lt;br /&gt;For that reason I've been pretty lenient on Oracle on the lack of information on Java that we developers have been getting.&lt;br /&gt;&lt;br /&gt;After reading &lt;a href="http://www.theregister.co.uk/2010/06/09/harmony_android_oracle_apache/"&gt;this&lt;/a&gt; however, my mercy is exhausted. Basically Oracle and the Apache Software Foundation still haven't come to an agreement.&lt;br /&gt;&lt;br /&gt;In the mean time it sucks to be a Java developer right now. It's been three and half years since we had a new version of Java, and no new official version on horizon.&lt;br /&gt;&lt;br /&gt;I've had more debates about "what comes after Java" in the past few months than in last 5 years.&lt;br /&gt;&lt;br /&gt;My question now to both Oracle and the ASF is this: What do you think the long term effect of this impasse is  going to be if you don't sort it, what value in Java are you destroying?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-3853522450726768953?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/06/question-for-oracle-and-apache-software.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-8037552602187325109</guid><pubDate>Fri, 30 Apr 2010 06:39:00 +0000</pubDate><atom:updated>2010-04-30T00:00:39.987-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">iPhone</category><category domain="http://www.blogger.com/atom/ns#">Apple</category><title>Steve Jobs and the future of Apple.</title><description>Ok I promise this is the last blog on Apple for a while...&lt;br /&gt;&lt;br /&gt;Steve Jobs recently published an &lt;a href="http://www.apple.com/hotnews/thoughts-on-flash/"&gt;article&lt;/a&gt; on Apples's web site detailing his reasons for why Flash is not allowed on the iPhone.&lt;br /&gt;&lt;br /&gt;The article has obviously taken quite a bit a bit of &lt;a href="http://www.osnews.com/story/23224/Jobs_on_Flash_Hypocrisy_So_Thick_You_Could_Cut_it_with_a_Knife"&gt;flak&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here's the thing though, much as everyone decries Apple, they tend to forget that Apple is not a monopoly in any market that it operates, and they can't force anyone to buy their products.&lt;br /&gt;&lt;br /&gt;This is important because if Apple manages to annoy enough developers and users, there are sufficient alternatives in the market to Apple products to allow said users and developers to leave.&lt;br /&gt;&lt;br /&gt;If this happens then it's fair to say that the only entity that is going to suffer in this mess is Apple itself.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-8037552602187325109?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/04/steve-jobs-and-future-of-apple.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-4933888136118793648</guid><pubDate>Fri, 29 Jan 2010 17:47:00 +0000</pubDate><atom:updated>2010-01-29T11:46:27.730-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">iPhone</category><category domain="http://www.blogger.com/atom/ns#">iPad</category><category domain="http://www.blogger.com/atom/ns#">Apple</category><title>A few thoughts on the iPad</title><description>Being the resident Mac fan I thought I might add my $0.02 on the iPad.&lt;br /&gt;&lt;br /&gt;Firstly the name is aweful, I can't believe that someone didn't start giggling the moment the suggestion was made. I have two theories about how this one got through; 1) The obvious : Steve Jobs made the suggestion therefore it was so. Or 2) The marketing guys were stereotypically stoned so that means a) no one thought much about the giggling and b) they were - well - stoned.&lt;br /&gt;&lt;br /&gt;Secondly, yes, it is a large iPhone. Rumor has it that the iPad design has gone back and forth between the drawing board and prototype stage a couple of times, in fact it's technologies became the basis of the iPhone, Now the leaked sources pretty much confirmed that the iPad was going to be using the iPhone OSX as a basis so the way the OS looks and works was not at all surprising, but I'm rather dissapointed that Apple chose to so blatantly follow the physical look of the iPhone, after all, it is a design which - while being very pretty - is getting on in the years. Now it was probably too late by then, but I hope Steve is going "Oh crap why didn't we think of that" when he watched Avatar.&lt;br /&gt;&lt;br /&gt;Thirdly it's not an iPhone at all. If you drill down into this logic you can quite easily make that argument that my laptop shares many of the characteristics of my iPhone by virtue of the fact that both can perform many of the same functions.&lt;br /&gt;&lt;br /&gt;So what is the iPad then, it's not a laptop, it's not a netbook, it's not a phone, it's also nothing at all like Bill Gate's vision for the tablet PC way back in 2001.&lt;br /&gt;&lt;br /&gt;The fact is that the iPad simply doesn't fall into any of the current categories, Apple has the rather daunting task of trying to create a completely new class of mobile device.&lt;br /&gt;&lt;br /&gt;This is both a blessing and a curse.&lt;br /&gt;&lt;br /&gt;If the iPad takes off, it will be great for Apple of course, being the pioneers in a new category, the problem of course is that in order for this new category to take off you need to have customers who have a reason to buy one.&lt;br /&gt;&lt;br /&gt;In other words you need a killer application.&lt;br /&gt;&lt;br /&gt;Now with that in mind here are a few things to ponder:&lt;br /&gt;&lt;br /&gt;The starting price is $499, which will translate into about +- R5500 after import duties (unless the importers decide to milk us dry). This makes it cheaper than many smartphones including HTC's Android phones. It also falls in the same pricing bracket as many Netbooks.&lt;br /&gt;&lt;br /&gt;It has quite an awesome battery life, You could use this device for most of the day, no boot up time and no hibernating.&lt;br /&gt;&lt;br /&gt;The type of functionality being offered by the iPad is basically 100% of what most mobile office workers need from a computing device, my boss for example spends his entire work day in meetings and uses his PC for nothing but e-mail and documents.&lt;br /&gt;&lt;br /&gt;I think therefore that there is potential for this device, however Apple is going to have to work harder to make that obvious.&lt;br /&gt;&lt;br /&gt;Now in closing it's worth noting that the device simple had no way to live up to the hype surrounding it. It's a version 1.0 device, it has many flaws and omissions which Apple will need to address (although at the price you DO get quite a bit), So quite honestly It mightn't be bad idea to wait for version 2.0.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-4933888136118793648?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2010/01/few-thoughts-on-ipad.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-5348488871911667786</guid><pubDate>Wed, 16 Dec 2009 11:54:00 +0000</pubDate><atom:updated>2009-12-16T05:20:14.309-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java scala groovy ruby clojure</category><title>No Next Big Language... Dunno, I suspect we may be stuck with one.</title><description>I've just read Alex Miller's &lt;a href="http://tech.puredanger.com/2009/12/15/the-next-big-language-is/"&gt;blog entry&lt;/a&gt; regarding the NBL (Next Big Language) or rather the fact that there will not be a NBL and that the age of multiple programming languages has arrived.&lt;br /&gt;&lt;br /&gt;I like the idea and I'm all for it to take off...&lt;br /&gt;&lt;br /&gt;It's just that in my experience companies, especially those who's core industry is not IT related tend to minimize risk as much as possible, and therefore try to stay as mainstream as possible.&lt;br /&gt;&lt;br /&gt;Java after all, quickly got pushed into the mainstream by companies like IBM and Oracle throwing their weight behind it, And consequently companies adopted it - I daresay - because it presented a much lower risk than many of it's competitors at the time such as Smalltalk.&lt;br /&gt;&lt;br /&gt;Furthermore companies seem to like to standardize on a programming language since it makes things like hiring and training and administration a lot easier.&lt;br /&gt;&lt;br /&gt;Its also these companies which keep the bulk of the programming community employed.&lt;br /&gt;&lt;br /&gt;Therefore as much the acceptance of multiple programming languages is growing among us programmers I see very little acceptance of it with these companies who fork out the majority of the cash to get systems built.&lt;br /&gt;&lt;br /&gt;Consider that Microsoft talked much about multiple programming languages when it released .Net and after almost 8 years you will be hard pressed to find a lot of work being done on .Net which isn't written in C# or VB.Net.&lt;br /&gt;&lt;br /&gt;Consequently then it's normal that one of the language will get used the most and therefore employ the most people and become the NBL.&lt;br /&gt;&lt;br /&gt;Now having said that I think Sun-Acle may actually be in a good position to take the multi-language concept mainstream, more so than Microsoft in 2002. For one thing the JVM is still the most portable runtime around, furthermore it's battle tested and smokin' fast. It's also widely adopted, supported and well understood.&lt;br /&gt;&lt;br /&gt;The JVM could allow a company to standardize on the infrastructure but pick the tool which will be the most productive for the development task at hand.&lt;br /&gt;&lt;br /&gt;Of course if this idea takes of, then we our next debate will be on the NBR (Next Big Runtime).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-5348488871911667786?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/12/no-next-big-language-dunno-i-suspect-we.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-8011175571053912989</guid><pubDate>Fri, 20 Nov 2009 05:23:00 +0000</pubDate><atom:updated>2009-11-19T21:38:37.272-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java7</category><title>Regarding Sun and Java 7 Closures</title><description>Here in South Africa we have a colloquial term: "oke". Pronounced "oak" it is basically a casual friendly reference for another male, kinda like "dude".&lt;br /&gt;&lt;br /&gt;The word itself is actually from the Afrikaans language and has transferred into daily use by English speaking South Africans males. How it originated in Afrikaans I don't really know, It might simply be the Afrikaans translation of the English "bloke".&lt;br /&gt;&lt;br /&gt;Typical usage is normally within a group of friends, for example you might tell your wife: "I'm off to have a beer with the &lt;span style="font-style: italic;"&gt;okes&lt;/span&gt;" or as a more general reference: "Geez! did you see that try by Brian Habanna! That &lt;span style="font-style: italic;"&gt;oke&lt;/span&gt; must be on speed or something".&lt;br /&gt;&lt;br /&gt;Now regarding Java 7 and closures, I have this to ask of Java's venerable leaders: "Dear Sun, what the [&lt;span style="font-style: italic;"&gt;expletive&lt;/span&gt;] are you okes doing?!"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-8011175571053912989?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/11/regarding-sun-and-java-7-closures.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-7245950927880005777</guid><pubDate>Wed, 23 Sep 2009 06:53:00 +0000</pubDate><atom:updated>2009-09-23T00:17:09.310-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">iPhone</category><category domain="http://www.blogger.com/atom/ns#">Apple</category><title>Apple and it's nefarious ways.</title><description>I hope this whole Google Voice App scandal completely blows up in Apple's face.&lt;br /&gt;&lt;br /&gt;A nice hefty fine consisting of least 9 digits would be perfect.&lt;br /&gt;&lt;br /&gt;Why you ask, because like other iPhone developers I'm rather fed up with the whole process.&lt;br /&gt;&lt;br /&gt;Furthermore Apple seems to forget that it's not a monopoly, I have plans to write software for the Android platform (when commercial apps come to my region), and quite honestly if the experience is better what reason could I possibly have to do iPhone work.&lt;br /&gt;&lt;br /&gt;A nice scandal like this might have the ability to force Apple to be a little more transparent with developers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-7245950927880005777?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/09/apple-and-its-nefarious-ways.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-9010227395401492924</guid><pubDate>Tue, 22 Sep 2009 18:41:00 +0000</pubDate><atom:updated>2009-09-22T13:11:40.680-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">fanboys of the world unite</category><title>The naked fan boy</title><description>I'm an Apple fan, and I am the proud owner of both a Mac book pro and an iPhone 3G. I've always been quite happy to admit that I am a "fanboy" of Apple products.&lt;br /&gt;&lt;br /&gt;It turns out though that I didn't actually know what a "fanboy" is.&lt;br /&gt;&lt;br /&gt;My understanding of what a fanboy is, is rather mundane: It's simply a person who is a fan of a product or brand or even a personality.&lt;br /&gt;&lt;br /&gt;My friend however has a different view, his view of what a fanboy is seems rather more suited to someone who is a member of Al-Qaeda.&lt;br /&gt;&lt;br /&gt;Now much as I like Apple I'm not blowing myself up because someone happens to criticise the new iPod.&lt;br /&gt;&lt;br /&gt;So in order to reduce my ignorance I consulted that completely reliable source of truth: Wikipedia to find out more about what a fanboy is. This is what I found:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;"Fanboy is a term originating in the United States[citation needed], used to describe a male who is highly devoted and biased in opinion towards a single subject or hobby within a given field. The earliest known recorded use is dated 1919.[5]"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The key phrases here are "highly devoted" and "biased".&lt;br /&gt;&lt;br /&gt;Kinda strong words for  something that should be as black and white as a technology choice.&lt;br /&gt;&lt;br /&gt;The fact is though that if you step back and look at the whole IT scene and apply this definition you can't help but feel that us computer geeks are nothing much but a whole bunch of fanboys. Here is a short non exhaustive list of some of the fanboy debates I've been privy to during my time as a computer geek:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;AMD vs Intel.&lt;/li&gt;&lt;li&gt;ATI vs NVidia.&lt;/li&gt;&lt;li&gt;3Dfx vs NVidia.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;.Net vs Java.&lt;/li&gt;&lt;li&gt;C++ vs Java.&lt;/li&gt;&lt;li&gt;[for brevity's sake: Insert your language of preference here] vs Java.&lt;/li&gt;&lt;li&gt;RISC vs CISC.&lt;/li&gt;&lt;li&gt;Linux vs BSD.&lt;/li&gt;&lt;li&gt;Linux vs Windows.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;OS2 Warp vs Windows 95.&lt;/li&gt;&lt;li&gt;Xbox vs Playstation.&lt;/li&gt;&lt;li&gt;Microsoft vs Open Source.&lt;/li&gt;&lt;li&gt;OSX vs Windows.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;What really amazes me though is how the same person who can explain to you the nuances of Lisp on the one hand, can then on the other hand scream bloody murder because you bought product X instead of Y and that makes you an idiot because product Y is clearly 5 attoseconds faster than product X and unlike product X, product Y's maker does not sacrifice little children in order to gain market share.&lt;br /&gt;&lt;br /&gt;And we're supposed to be that smart guys....&lt;br /&gt;&lt;br /&gt;I guess it's perhaps a reflection of our passion, by in large technology people are very passionate about what they do and have a strong belief in the importance of what they do, after all; no other profession has caused as a dramatic a change in the last few decades to the way the world works as we have.&lt;br /&gt;&lt;br /&gt;Of course it's perhaps also indicative of the fact that when it's all said and done, Computer geeks are just as driven by emotion as the rest of humanity.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-9010227395401492924?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/09/naked-fan-boy.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-8110152156382947394</guid><pubDate>Fri, 18 Sep 2009 11:10:00 +0000</pubDate><atom:updated>2009-09-18T09:05:51.036-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">scala</category><title>A quick sample of Lists and Tuples in Scala</title><description>So I've been challenged with a simple problem to solve in Scala, that is; to take a List of values and and then sum each corresponding value in the list together into a resultant list.&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;[1,2,3,4,5]&lt;/span&gt; becomes&lt;span style="font-weight: bold;"&gt; [3,5,7,9]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can accomplish this in Scala using the List class and its functions, these include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;zip&lt;/span&gt; : this function takes an input list and creates a list of tuples with each mapping pair, discarding jagged values.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;tail&lt;/span&gt; : this function returns a list minus the first element of the list on which tail is performed.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;foldLeft&lt;/span&gt; : combines the elements of the list together with a seed value (in my case I use a target List).&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;reverse&lt;/span&gt; : reverses the order of the list.&lt;/li&gt;&lt;/ul&gt;so here is the code to do this:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;object SumPairs extends Application {&lt;br /&gt;&lt;br /&gt;val numbers = List(1,2,3,4,5);&lt;br /&gt;val result = numbers.zip(numbers.tail)&lt;br /&gt;             .foldLeft(List[Int]()) (&lt;br /&gt;                (list, y) =&amp;gt; {&lt;br /&gt;                   y._1 + y._2 :: list&lt;br /&gt;                }&lt;br /&gt;              )&lt;br /&gt;             .reverse;&lt;br /&gt;println(result);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Basically this works as follows:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;I create a List of Tuples of each adjacent value in the List by getting the tail of the List.&lt;/li&gt;&lt;li&gt;I get each Tuple in the list, sum it and prepend it to the List returned by "foldLeft".&lt;/li&gt;&lt;li&gt;I reverse the List to fix the order as a result of doing a prepend.&lt;/li&gt;&lt;/ol&gt;Now this is is designed to be functional but not overly complex (at least I hope not), Since I'm still fairly green in the Scala dark arts I'd like to hear on improvements.&lt;br /&gt;&lt;br /&gt;BTW the challenge I'm talking about can be found &lt;a href="http://github.com/apauley/RandomHacks/tree/master/CodeSnippets/SumPairs/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;UPDATE:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;Another solution would be to use &lt;i&gt;List.flatMap&lt;/i&gt; which basically takes a function which returns an &lt;i&gt;Iterable &lt;/i&gt;and appends it to a function, it pretty similar, It's maybe a little more concise, I'll let you decide:&lt;/div&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;val numbers = List(1,2,3,4,5);&lt;br /&gt;numbers.zip(numbers.tail).flatMap {&lt;br /&gt;     value =&amp;gt; {&lt;br /&gt;          List(value._1+value._2);&lt;br /&gt;      }&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-8110152156382947394?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/09/quick-sample-of-lists-and-tuples-in.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-3245793227443394452</guid><pubDate>Sat, 01 Aug 2009 06:52:00 +0000</pubDate><atom:updated>2009-08-01T00:25:24.572-07:00</atom:updated><title>Dynamic Data Access Objects for JPA</title><description>JPA is pretty cool and JPA 2.0 looks even better, in a standardised way JPA has managed to rid us of the pain of CRUD, which; when it's all said and done is still the heart of most enterprise apps.&lt;br /&gt;&lt;br /&gt;One thing that isn't very clear is how to implement the Data Access Object pattern in JPA. For one thing EntityManager pretty much takes car of abstracting your data access and that as some notable &lt;a href="http://www.adam-bien.com/roller/abien/entry/generic_crud_service_aka_dao"&gt;authors&lt;/a&gt; have pointed out you don't necessarily need to create a DAO at all. I agree with this but there are a couple of problems I keep running in to:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;How to manage the vast numbers of queries that you get when you start doing anything useful in an Enterprise System. &lt;/li&gt;&lt;li&gt;Testing is made hard in that &lt;span style="font-style: italic;"&gt;EntityManager &lt;/span&gt;is the pits to test especially when you start writng queries with many parameter, inevitably you end up with a vast brittle network of mocked objects which don't actually add any value and make my life miserable every time you make a change.&lt;/li&gt;&lt;li&gt;Named queries are great but but they really bloat your code for a multitude of "adhoc" queries which just seem overkill for me to put into a &lt;span style="font-style: italic;"&gt;NamedQuery&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;Queries are still strings and until JPA2.0 rolls out we can't avoid this indirection. One of things that the DAO pattern used to provide is a method for a query which normally named the purpose of the query and named its parameters and typed them, which was a real blessing when you had to work on code several years old.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Of course the other side of the coin is that we don't want to bring back a lot of boilerplate code, and end up writing too much custom stuff which re-implements features that JPA already has.&lt;br /&gt;&lt;br /&gt;My suggestion therefore is to shamelessly steal ideas from Ruby on Rails albeit in a Java-fied manner.&lt;br /&gt;&lt;br /&gt;The idea in question is the concept of a finder method in Rails. The one where you can simply call a class method on your Entity: &lt;span style="font-weight: bold; font-style: italic;"&gt;EntityClass.findByName(theName)&lt;/span&gt; and thanks to the magic of Ruby's MOP; Rail's &lt;span style="font-style: italic;"&gt;ActiveRecord&lt;/span&gt; pattern ORM framework can dynamically generate a sql query to go hunt for records for the entity where the &lt;span style="font-style: italic;"&gt;name &lt;/span&gt;column is equal to "&lt;span style="font-style: italic;"&gt;theName&lt;/span&gt;". All this without you having to write a single line of additional code.&lt;br /&gt;&lt;br /&gt;Of course by now most readers will be smiling since they know that Java definitely has no Meta class facilities. This is of course very true, We can't replicate the exact flexibility of ActiveRecord but we can get some features by resorting to the closest thing Java gives; none other than the good old Dynamic Proxy.&lt;br /&gt;&lt;br /&gt;Lets take the following interface:&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;&lt;br /&gt;package repo;&lt;br /&gt;import java.util.Collection;&lt;br /&gt;&lt;br /&gt;public interface AnEntityRepository extends EntityRepository&amp;lt;AnEntity&amp;gt; {&lt;br /&gt;&lt;br /&gt; AnEntity findByName(String name);&lt;br /&gt;&lt;br /&gt; Collection&amp;lt;AnEntity&amp;gt; findAll();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;This interface extends an interface called &lt;span style="font-weight: bold; font-style: italic;"&gt;EntityRepository &lt;/span&gt;(this is just a little marker interface so that I can hit &lt;span style="font-style: italic;"&gt;F4 &lt;/span&gt;in Eclipse and I also use the type parameter to link the interface to an Entity) Each method on the interface maps to a specific query we want to run against an Entity class "&lt;span style="font-weight: bold; font-style: italic;"&gt;AnEntity&lt;/span&gt;", the first method is a simple &lt;span style="font-style: italic;"&gt;findByName &lt;/span&gt;which will have JPAQL generated dynamically, the next one is &lt;span style="font-style: italic;"&gt;findAll &lt;/span&gt;which we map to a Named query.&lt;br /&gt;&lt;br /&gt;Here is how we will do it: we will pass this interface to the dynamic proxy framework together with our own code to handle invocations which will do the following: first try map the invoked method name to a named query, if that fails we check if the method name starts with "&lt;span style="font-style: italic;"&gt;findBy&lt;/span&gt;" we then do some funky string gymnastics on the rest of the method name to attempt to extract properties of the targeted entity and then build some &lt;span style="font-style: italic;"&gt;JPAQL &lt;/span&gt;from that, then create the query and map the passed method parameters as query parameters to it. If any of the previous steps fail we blow up with a Runtime exception.&lt;br /&gt;&lt;br /&gt;First step: The proxy framework requires an invocation handler (&lt;span style="font-weight: bold; font-style: italic;"&gt;java.lang.reflect.InvocationHandler&lt;/span&gt;), this class is responsible for handling method dispatches from the proxied interface, mine is called &lt;span style="font-weight: bold; font-style: italic;"&gt;RepoInvocationHandler &lt;/span&gt;(Repo being short for Repository):&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;&lt;br /&gt;package repo;&lt;br /&gt;&lt;br /&gt;import java.lang.reflect.InvocationHandler;&lt;br /&gt;import java.lang.reflect.Method;&lt;br /&gt;&lt;br /&gt;public class RepoInvocationHandler implements InvocationHandler {&lt;br /&gt;&lt;br /&gt; public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;the &lt;span style="font-style: italic;"&gt;invoke &lt;/span&gt;method will actually handle all the dispatches coming from the proxy, the parameters indicate the proxy instance that called with method, the actual method being called and the parameters that were passed to the method respectively. The first iteration of this invocation handler will be to build a JPAQL from the simple finder method, note that we pass a class in to the invocation handler, this is the entity we wish to query. Here is the implementation of the &lt;span style="font-weight: bold; font-style: italic;"&gt;RepoInvocationHandler &lt;/span&gt;to do precisely that:&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;&lt;br /&gt;package repo;&lt;br /&gt;&lt;br /&gt;import java.lang.reflect.InvocationHandler;&lt;br /&gt;import java.lang.reflect.Method;&lt;br /&gt;import java.util.Collections;&lt;br /&gt;import javax.persistence.EntityManager;&lt;br /&gt;import javax.persistence.Query;&lt;br /&gt;&lt;br /&gt;public class RepoInvocationHandler implements InvocationHandler {&lt;br /&gt;&lt;br /&gt; Class&amp;lt;?&amp;gt; targetEntity;&lt;br /&gt; EntityManager entityManager;&lt;br /&gt;&lt;br /&gt; public RepoInvocationHandler(Class&amp;lt;?&amp;gt; targetEntity, EntityManager entityManager) {&lt;br /&gt;    this.targetEntity = targetEntity;&lt;br /&gt;    this.entityManager = entityManager;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {&lt;br /&gt;    String name = method.getName();&lt;br /&gt;    String query = buildQuery(name);&lt;br /&gt;    Query q = entityManager.createQuery(query);&lt;br /&gt;    int parmIndex = 0;&lt;br /&gt;    for (Object arg : args) {&lt;br /&gt;      q.setParameter(parmIndex++, arg);&lt;br /&gt;    }&lt;br /&gt;    //we can add the functionality to return a single result or multiples&lt;br /&gt;    //by checking if the return type is a Collection instance.&lt;br /&gt;    if (Collections.class.isAssignableFrom(method.getReturnType())) {&lt;br /&gt;       return q.getResultList();&lt;br /&gt;    } else {&lt;br /&gt;       return q.getSingleResult();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; String uncapatalise(String property) {&lt;br /&gt;    return property.substring(0,1).toLowerCase()+property.substring(1);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; String buildQuery(String name) {&lt;br /&gt;   if (name.startsWith("findBy")) {&lt;br /&gt;      String property = name.substring("findBy".length());&lt;br /&gt;      //uncapitalise to adhere to conventions&lt;br /&gt;      property = uncapatalise(property);&lt;br /&gt;      return "select x from " + targetEntity.getName() + " x where x." + property + " = ?";&lt;br /&gt;   }&lt;br /&gt;   throw new RuntimeException("oops, looks "+name+" is not a finder method");&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;/pre&gt;A note: you can make finder methods as complex as you want, this case just takes a single property and does an equals to query (&lt;span style="font-style: italic;"&gt;select x from repo.AnEntity x where x.name = ?&lt;/span&gt;). The possibilities -however - are endless, Ive implemented this with AND and OR functionality so I can write "&lt;span style="font-style: italic;"&gt;findByNameAndSurname(String name, String surname)&lt;/span&gt; or "&lt;span style="font-style: italic;"&gt;findByNameOrSurname(String name, String surname)&lt;/span&gt; with &lt;span style="font-style: italic;"&gt;n &lt;/span&gt;levels of predicates. however I want to keep the features of the generated finder method simple, if your query becomes to complex it should become a &lt;span style="font-style: italic;"&gt;NamedQuery&lt;/span&gt;, which then brings us to the next iteration.&lt;br /&gt;&lt;br /&gt;The next iteration of the invocation handler adds the ability to utilise &lt;span style="font-style: italic;"&gt;NamedQuery &lt;/span&gt;functionality in order to handle complex queries, it also allows us to override the standard finder functionality:&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;package repo;&lt;br /&gt;&lt;br /&gt;import java.lang.reflect.InvocationHandler;&lt;br /&gt;import java.lang.reflect.Method;&lt;br /&gt;import java.util.Collections;&lt;br /&gt;import javax.persistence.EntityManager;&lt;br /&gt;import javax.persistence.Query;&lt;br /&gt;&lt;br /&gt;public class RepoInvocationHandler implements InvocationHandler {&lt;br /&gt;&lt;br /&gt; Class&amp;lt;?&amp;gt; targetEntity;&lt;br /&gt; EntityManager entityManager;&lt;br /&gt;&lt;br /&gt; public RepoInvocationHandler(Class&amp;lt;?&amp;gt; targetEntity, EntityManager entityManager) {&lt;br /&gt;  this.targetEntity = targetEntity;&lt;br /&gt;  this.entityManager = entityManager;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {&lt;br /&gt;  String name = method.getName();&lt;br /&gt;&lt;br /&gt;  Query q = null;&lt;br /&gt;  //Note that I create a named query in the format EntityClassSimpleName.methodName&lt;br /&gt;  //this is because named queries are global not so by prefixing the entity class name&lt;br /&gt;  //it mostly eliminates duplicate named queries, it also gives a useful convention.&lt;br /&gt;  try {&lt;br /&gt;      String namedQuery = targetEntity.getSimpleName()+"."+method.getName();&lt;br /&gt;      q = entityManager.createNamedQuery(namedQuery);&lt;br /&gt;  } catch (IllegalArgumentException e) {&lt;br /&gt;      //yes there are more efficient ways to do this, however this is easiest&lt;br /&gt;  }&lt;br /&gt;  //no named query so lets build one from the method name&lt;br /&gt;  if (q == null) {&lt;br /&gt;      String query = buildQuery(name);&lt;br /&gt;      q = entityManager.createQuery(query);&lt;br /&gt;  }&lt;br /&gt;  int parmIndex = 0;&lt;br /&gt;  for (Object arg : args) {&lt;br /&gt;      q.setParameter(parmIndex++, arg);&lt;br /&gt;  }&lt;br /&gt;  if (Collections.class.isAssignableFrom(method.getReturnType())) {&lt;br /&gt;      return q.getResultList();&lt;br /&gt;  } else {&lt;br /&gt;      return q.getSingleResult();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;String uncapatalise(String property) {&lt;br /&gt;  return property.substring(0,1).toLowerCase()+property.substring(1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;String buildQuery(String name) {&lt;br /&gt;&lt;br /&gt;  if (name.startsWith("findBy")) {&lt;br /&gt;      String property = name.substring("findBy".length());&lt;br /&gt;      //uncapitalise to adhere to conventions&lt;br /&gt;      property = uncapatalise(property);&lt;br /&gt;      return "select x from " + targetEntity.getName() + " x where " + property + " = ?";&lt;br /&gt;  }&lt;br /&gt;  throw new RuntimeException("oops, looks "+name+" is not a finder method");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;For reference purposes I've included what the &lt;span style="font-style: italic;"&gt;NamedQuery &lt;/span&gt;declaration would look like on &lt;span style="font-weight: bold; font-style: italic;"&gt;AnEntity &lt;/span&gt;for the method "&lt;span style="font-style: italic;"&gt;findAll&lt;/span&gt;":&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;@NamedQueries( {&lt;br /&gt; @NamedQuery(name="AnEntity.findAll", query="select x from AnEntity x")&lt;br /&gt;})&lt;br /&gt;public class AnEntity implements Serializable{&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;And there we have the basic functionality I want to implement, the last thing we need to do is create the proxy, I have a simple factory which takes in the Interface (I've forced all the interfaces to extend the &lt;span style="font-style: italic;"&gt;EntityRepository &lt;/span&gt;interface, for documentation and typing purposes) as follows:&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;package repo;&lt;br /&gt;&lt;br /&gt;import java.lang.reflect.ParameterizedType;&lt;br /&gt;import java.lang.reflect.Proxy;&lt;br /&gt;import javax.persistence.EntityManager;&lt;br /&gt;&lt;br /&gt;public class EntityRepositoryFactory {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public static &amp;lt;T extends EntityRepository&amp;lt;?&amp;gt;&amp;gt; T createEntityRepository(Class&amp;lt;T&amp;gt; homeRepositoryClass, EntityManager entityManager) {&lt;br /&gt;  ParameterizedType type = (ParameterizedType) homeRepositoryClass.getGenericInterfaces()[0];&lt;br /&gt;  Class&amp;lt;?&amp;gt; entityType = (Class&amp;lt;?&amp;gt;) type.getActualTypeArguments()[0];&lt;br /&gt;  return (T) Proxy.newProxyInstance(&lt;br /&gt;                  Thread.currentThread().getContextClassLoader(),&lt;br /&gt;                  new Class[] {homeRepositoryClass},&lt;br /&gt;                  new RepoInvocationHandler(entityType, entityManager));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Finally using this interface is as simple as creating it via the factory and then calling the methods:&lt;br /&gt;&lt;pre style="font-size: 90%; color: rgb(0, 144, 0);"&gt;   AnEntityRepository repo = EntityRepositoryFactory&lt;br /&gt;                              .createEntityRepository(AnEntityRepository.class, entityManager);&lt;br /&gt;  AnEntity entity = repo.findByName("Fred");&lt;br /&gt;  Collection&amp;lt;AnEntity&amp;gt; allEntities = repo.findAll();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;A few final notes:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;For testing purposes you simply mock out the &lt;span style="font-style: italic;"&gt;&lt;/span&gt;interface, either with a mocking framework or an anonymous classes.&lt;/li&gt;&lt;li&gt;There's nothing stopping you from creating the factory in Spring if you are using Spring.&lt;/li&gt;&lt;li&gt;I wish EJB3.1 had introduced a Factory concept for creating instances of beans much like Spring has this would make life easer in the EJB world.&lt;/li&gt;&lt;li&gt;Sooner or later you will need to create pagination, you can add this functionality by using parameter annotations, I was thinking of something like: "&lt;span style="font-weight: bold; font-style: italic;"&gt;findAll(@Start int start,@Max int max)&lt;/span&gt;";.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-3245793227443394452?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/07/dynamic-data-access-objects-for-jpa.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-6455786466235126676</guid><pubDate>Mon, 08 Jun 2009 17:27:00 +0000</pubDate><atom:updated>2009-06-08T11:04:10.876-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java scala groovy ruby clojure</category><title>Is Javaless Java reaching critical mass?</title><description>There is a lot of talk about how this is possibly the last JavaOne, as Oracle is about to buy Sun out.&lt;br /&gt;&lt;br /&gt;However if you look at what everybody was at talking about at JavaOne you can't but help get the idea that JavaOne is an anachronism any way, this trend seems to involve:&lt;br /&gt;&lt;br /&gt;- JavaFX.&lt;br /&gt;- Groovy.&lt;br /&gt;- Scala.&lt;br /&gt;- JRuby.&lt;br /&gt;- Honourable mentions for Clojure and Jython.&lt;br /&gt;&lt;br /&gt;It's hard to miss the lack of Java here...&lt;br /&gt;&lt;br /&gt;Ok so people are interested in other languages in the JVM, however interest doesn't necessarily translate into use. &lt;br /&gt;&lt;br /&gt;This brings me to my question: have alternative JVM languages gone mainstream? can I go to my client who is still trying to get COBOL out of their system and confidently sell him on one of these alternative languages?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-6455786466235126676?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/06/is-javaless-java-reaching-critical-mass.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>8</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4133036378510199203.post-170513670340814921</guid><pubDate>Mon, 01 Jun 2009 16:09:00 +0000</pubDate><atom:updated>2009-06-01T10:31:25.364-07:00</atom:updated><title>Enterprise Scala Beans</title><description>This is a "hello world" tutorial to show how to get a Scala class configured to run as an EJB 3.0 inside a JEE app server, in this case Glassfish V2.&lt;br /&gt;&lt;br /&gt;Why exactly are you doing this?&lt;br /&gt;&lt;br /&gt;Well mostly to see if it's possible, one of Scala's benefits is the fact that it runs on a Java Virtual Machine with Java interoperability as a feature, this would allow developers to make use of Scala's additional language features to create a little more concise code and still make use of an enterprise's existing investments in JEE.&lt;br /&gt;&lt;br /&gt;First up.&lt;br /&gt;&lt;br /&gt;To create EJB3.0 beans, a language will need to support the following:&lt;br /&gt;&lt;br /&gt;- A compiler which compiles to standard Java classes (with the actual implementation bean using the standard no-args constructor for instantiation).&lt;br /&gt;- A construct which can map logically and physically to a Java interface in order to support the EJB's local and remote interfaces.&lt;br /&gt;- Annotations (although you could get away with ejb-jar.xml but that sucks) in order to integrate into the EJB container.&lt;br /&gt;&lt;br /&gt;Huh?! you need interfaces! Scala doesn't have interfaces!.&lt;br /&gt;&lt;br /&gt;Scala does not have interfaces per se, however it has traits (basically interfaces which allow implementation of methods). As it turns out Scala compiles the basic type skeleton specified by the trait into an interface.&lt;br /&gt;&lt;br /&gt;Now with that out the way here's the code:&lt;br /&gt;&lt;br /&gt;First we define the Trait which will serve as a remote Interface, for our example we are going to define a simple trait called &lt;span style="font-weight:bold;"&gt;ITest&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;package net.jexenberger&lt;br /&gt;&lt;br /&gt;trait ITest {&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;  def doStuff(x: String) : String;&lt;br /&gt; &lt;br /&gt;  def hello() : Unit = {&lt;br /&gt;    System.out.println(&amp;quot;hello world&amp;quot;);&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This trait has one unimplemented method and one implemented method (this is to illustrate that you don't lose the functionality of traits with Scala when you have to work in a pure interface world).&lt;br /&gt;&lt;br /&gt;Secondly we define the actual implemention of the trait &lt;span style="font-weight:bold;"&gt;ITest&lt;/span&gt; in a class &lt;span style="font-weight:bold;"&gt;TestBean &lt;/span&gt;as follows:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;package net.jexenberger&lt;br /&gt;&lt;br /&gt;import javax.ejb._;&lt;br /&gt;import javax.annotation._;&lt;br /&gt;&lt;br /&gt;@Stateless { val name=&amp;quot;ScalaTestBean&amp;quot;, val mappedName=&amp;quot;ScalaTestBean&amp;quot; }&lt;br /&gt;@Remote {val value = Array(classOf[ITest])}&lt;br /&gt;class TestBean extends ITest {&lt;br /&gt; &lt;br /&gt;  @Resource&lt;br /&gt;  var ctx:SessionContext = null&lt;br /&gt; &lt;br /&gt;  def doStuff(x : String)  : String = {&lt;br /&gt;      &amp;quot;hello &amp;quot;+x+&amp;quot; called with &amp;quot;+this.ctx.toString()&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  @PostConstruct&lt;br /&gt;  def postConstruct() : Unit = {&lt;br /&gt;    System.out.println(&amp;quot;Post Construct called&amp;quot;);&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Note the following about the implementation:&lt;br /&gt;&lt;br /&gt;Firstly you will see that annotations are defined almost exactly the same as in Java, however the annotations have been "Scalafied" to look more Scala like with the use val and functions and of course Arrays, as illustrated by the &lt;span style="font-weight:bold;"&gt;@Remote&lt;/span&gt; usage above the class declaration. Finally we also inject the &lt;span style="font-weight:bold;"&gt;java.ejb.SessionContext&lt;/span&gt; object as an instance variable &lt;span style="font-style:italic;"&gt;ctx&lt;/span&gt; and a &lt;span style="font-weight:bold;"&gt;@PostConstruct&lt;/span&gt; method; &lt;span style="font-weight:bold;"&gt;postConstruct()&lt;/span&gt;, this is to test that we can map Scala variables and methods directly to Java methods and variables in order to utilise the EJB container's dependency injection mechanism and to integrate into the EJB lifecycle.&lt;br /&gt;&lt;br /&gt;We can now package the bean into a standard java jar (with &lt;span style="font-weight:bold;"&gt;META-INF/ejb-jar.xml&lt;/span&gt; if required), it can then be deployed as part of an EAR or indeed as a standalone EJB application. I built and packaged the project using Maven's standard &lt;span style="font-style:italic;"&gt;maven-ejb-plugin&lt;/span&gt; and the Maven Scala plugin (&lt;span style="font-style:italic;"&gt;org.scala-tools.maven-scala-plugin&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;Finally we write a remote client to invoke the Scala EJB:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;package net.jexenberger;&lt;br /&gt;&lt;br /&gt;import java.util.Properties;&lt;br /&gt;import javax.naming.Context;&lt;br /&gt;&lt;br /&gt;public class JavaTest&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) throws Exception {&lt;br /&gt;        Properties props = new Properties();&lt;br /&gt;        props.setProperty(&amp;quot;java.naming.factory.initial&amp;quot;, &amp;quot;com.sun.enterprise.naming.SerialInitContextFactory&amp;quot;);&lt;br /&gt;        props.setProperty(&amp;quot;java.naming.factory.url.pkgs&amp;quot;, &amp;quot;com.sun.enterprise.naming&amp;quot;);&lt;br /&gt;        props.setProperty(&amp;quot;java.naming.factory.state&amp;quot;, &amp;quot;com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl&amp;quot;);&lt;br /&gt;&lt;br /&gt;        Context ctx = new javax.naming.InitialContext(props);&lt;br /&gt;        ITest instance = (ITest) ctx.lookup(&amp;quot;ScalaTestBean&amp;quot;);&lt;br /&gt;        System.out.println(instance.doStuff(&amp;quot;world&amp;quot;));&lt;br /&gt;        instance.hello();&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Note that is a straight Java class, used to illustrate that the EJB could still be consumed by using straight Java code, also note that ITest is recognised as a standard Java interface.&lt;br /&gt;&lt;br /&gt;The output produced by by running the client is:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;net.jexenberger.personal._ITest_Wrapper@4a1c06a1&lt;br /&gt;hello world called with ScalaTestBean; id: [B@12d9e34&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And on the server we get:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;[#&amp;#124;2009-06-01T13:13:12.538+0200&amp;#124;INFO&amp;#124;sun-appserver2.1&amp;#124;javax.enterprise.system.stream.out&amp;#124;_ThreadID=23;_ThreadName=p: thread-pool-1; w: 9;&amp;#124;&lt;br /&gt;Post Construct called&amp;#124;#]&lt;br /&gt;&lt;br /&gt;[#&amp;#124;2009-06-01T13:13:12.541+0200&amp;#124;INFO&amp;#124;sun-appserver2.1&amp;#124;javax.enterprise.system.stream.out&amp;#124;_ThreadID=23;_ThreadName=p: thread-pool-1; w: 9;&amp;#124;&lt;br /&gt;hello world&amp;#124;#]&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And there we have it. An EJB 3.0 compliant Scala Enterprise Bean!&lt;br /&gt;&lt;br /&gt;A final note on packaging and deployment:&lt;br /&gt;&lt;br /&gt;Scala obviously requires its supporting runtime and libraries, in order to do this, you will need to package and specify the dependencies in an EAR or copy it into a location in your app Server. In Glassfish the easiest thing to do is copy scala-library.jar to &lt;span style="font-style:italic;"&gt;[Glassfish home]&lt;/span&gt;/lib/endorsed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4133036378510199203-170513670340814921?l=dotneverland.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://dotneverland.blogspot.com/2009/06/enterprise-scala-beans.html</link><author>noreply@blogger.com (julian_za)</author><thr:total>3</thr:total></item></channel></rss>

