<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>John Ferguson Smart&apos;s Blog</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/" />
<modified>2008-05-15T22:28:42Z</modified>
<tagline></tagline>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358</id>
<generator url="http://www.movabletype.org/" version="3.01D">Movable Type</generator>
<copyright>Copyright (c) 2008, johnsmart</copyright>
<entry>
<title>Another Java Power Tools Bootcamp at Welington, New Zealand</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/05/another_java_po.html" />
<modified>2008-05-15T22:28:42Z</modified>
<issued>2008-05-15T22:28:35Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9818</id>
<created>2008-05-15T22:28:35Z</created>
<summary type="text/plain">After the success of the first Java Power Tools bootcamp, another bootcamp has been scheduled in Wellington for the 25th-28th of August.</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<p>
For those who missed out on the first <a href="http://www.wakaleo.com/training/java-power-tools-bootcamp">Java Power Tools Bootcamp</a> in Wellington, another bootcamp has been scheduled in <a href="http://www.wakaleo.com/training/java-power-tools-bootcamp/wellington-august-25-28">Wellington</a> for the 25th-28th of August.
</p>

<a href="http://www.wakaleo.com/training/java-power-tools-bootcamp"><img src="http://www.wakaleo.com/images/bootcamp.jpg" style="width:160px;height:120px;float:right;" /></a>

<p>
The Java Power Tools Bootcamp is a comprehensive, innovative and hands-on workshop covering best-of-breed open source tools and techniques for Agile Development in Java. Learn how to optimize your development process, hone your programming skills and know-how, and ultimately produce better software. It covers key areas of software development and best practices, including:
<ul>
    <li>Agile Development Principles and Practices and Maven 2</li>
    <li>Unit and Integration testing with JUnit 4, Hamcrest, Selenium and so on.</li>
    <li>Code quality and documentation with tools like Checkstyle, PMD, FindBugs and Crap4J</li>
    <li>SCM and Continuous Integration with Subversion and Hudson</li>
</ul> 
</p>]]>

</content>
</entry>
<entry>
<title>A short primer on Java enums - part 1</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/05/a_short_primer.html" />
<modified>2008-05-15T02:23:54Z</modified>
<issued>2008-05-15T02:23:22Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9808</id>
<created>2008-05-15T02:23:22Z</created>
<summary type="text/plain">In his JavaOne talk this year, Josh Bloch gave some very useful tips about using enums in Java. Here is my take on enums, and how to use them to represent simple value lists which would otherwise be stored in code tables.</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<iframe src="http://rcm.amazon.com/e/cm?t=wakaconsltd-20&o=1&p=8&l=as1&asins=0596527934&fc1=000000&IS2=1&lt1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;float:right;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>

<p>
In his JavaOne talk this year, Josh Bloch gave some very useful tips about using enums in Java. Here is my take on enums, and how to use them to represent simple value lists which would otherwise be stored in code tables. This document is in two parts - Part one covers the basics of Java enums, and Part 2 goes into more advanced use cases such as using enums with Hibernate.
</p>

<h3>Introducing Java enums</h3>

<p>
An enum represents a pre-defined list of static values. Most applications have lots of places where you need this sort of thing. Colours, states, font-styles - the list is endless. A common older approach (required before Java 5) was to define lists of static values is to use integer constants, as shown here:
<pre>
public class Issue {
    public static final int STATUS_OPEN = 1;
    public static final int STATUS_CLOSED = 2;
    public static final int STATUS_REOPENED = 3;
    
    private int status;

    public void setStatus(int status) {
        this.status = status
    }
    ...
}
</pre>
</p>

<p>
However, this is a very poor solution, for many reasons, that Josh discusses in some detail in his <a href="">Effective Java</a> book. For example, there is no type safety. You can use any integer value in this field, which can result in errors, eg:
<pre>
    issue.setStatus(4); // This is wrong!
</pre>
</p>
<p>
In addition, the solution is fragile. These values are integers, so they will be compiled into the classes that use them. Should you modify the int value associated with a particular constant, the client classes will not automatically recompile. And if the client classes are not recompiled, they will continue to use the old values, which will result in strange errors.
</p>
</p>
Luckely, in Java 5, you can use <strong>enum</strong>s for a much more type-safe approach. An enum is basically a type-safe, pre-defined list of values, which you can define as follows:
<pre>
public enum Status {
    Open, Closed, Reopened
};
</pre>
</p>

<p>
You can define an enum in the same way as you would a class. Enums that are used by many classes should be defined as public, stand-alone classes, defined in their own *.java file. Enums that are only used by a particular class, on the other hand should be defined as public inner classes, as shown here:
<pre>
public class Issue {

    public enum Status {
        Open, Closed, Reopened
    };

    private Status status;

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        this.status = status;
    }
    ...
}
</pre>
</p>

<p>
On of the great things about this is how typesafe it all is. You can use an enum like this as follows:
<pre>
        Issue issue = new Issue();
        issue.setStatus(Issue.Status.Closed);
        assertThat(issue.getStatus(), is(Issue.Status.Closed)); 
</pre>
</p>

<p>
Here, you cannot fail to put a legal value into the status field, as it is verified by the compiler. For example, the following code, where we try to assign an Importance value to the Status field, simply won't compile:
<pre>
        Issue issue = new Issue();
        activity.setStatus(Issue.Importance.Low);  // This will not compile
</pre>
</p>

<p>
Of course, if you use static imports, the code is even simpler:
<pre>
import static com.mycompany.Issue.Status.Closed;
        ...
        Issue issue = new Issue();
        issue.setStatus(Closed);
</pre>
</p>

<h3>Listing enum values</h3>

<p>
Now there are times that you might need to list the values in an enumaration. For example, you may want to create a list of entries in a SELECT element on an HTML page. You can do this with the static <pre>values()</pre> method, as shown here:
<pre>
        ActivityStatus[] values = ActivityStatus.values();
        for(ActivityStatus status : values) {
            System.out.println(status);
        }
</pre>
</p>

<p>
This will produce the following list:
<pre>
Open
Closed
Reopened
</pre>
</p>

<p>
Easy! Note that the enum values are displayed in their natural order (their order of appearance in the Java class), not in alphabetical order. This means you can define an implicit order, and not worry about having to add an extra field to define the order manually.
</p>

<h3>Conclusion</h3>

<p>
So now, we've covered some of the basic uses of enums. In the next part of this article, we will look at more advanced uses of enums, such as how they integrate with Hibernate.
</p>]]>

</content>
</entry>
<entry>
<title>JavaOne 2008 - The new NetBeans Javascript editor</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/05/javaone_2008_th.html" />
<modified>2008-05-09T19:50:58Z</modified>
<issued>2008-05-09T19:50:49Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9773</id>
<created>2008-05-09T19:50:49Z</created>
<summary type="text/plain">The latest version of NetBeans makes working with Javascript almost as easy as working with with Java
</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<iframe src="http://rcm.amazon.com/e/cm?t=wakaconsltd-20&o=1&p=8&l=as1&asins=0596527934&fc1=000000&IS2=1&lt1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;float:right;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
<p>Personally, I hate Javascript with a passion. This is largely my fault - I just haven't taken the time to learn it properly. Unfortunately, there are still times when you just have to work with it. And the lack of syntax checking and code completion has always driven me crazy.</p>
<p>This morning, I saw a most impressive demo - the new Javascript editor in NetBeans. Now, when you work with Javascript in NetBeans, you get proper code completion, complete with lists of available methods and API documentation. The API documentation also includes information about browser compatibility for each function. Sweet!</p>
<p>Technically, all this is no mean feat. Since Javascript is typeless, code completion is inferred dynamically from the way you use the objects in the code. So if you create a class dynamically in Javascript, you get code completion for this as well! If you document your Javascript using Javadoc-style comments, you can also have the documentation appearing with the code completion</p>
<p>There is also real-time syntax checking, and also best-practice rules, such as confusing '=' and '=='. And you get a proper debugger, via a Firefox plugin, where you can step through the javascript, insert breakpoints, view variables, and so on.</p>
<p>A very nice piece of work. A longtime Eclipse user, I am really impressed by the progress NetBeans has made over the last few versions.
</p>]]>

</content>
</entry>
<entry>
<title>JavaOne 2008 - geeky gadgets galore!</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/05/javaone_2008_ge.html" />
<modified>2008-05-09T19:36:28Z</modified>
<issued>2008-05-09T19:36:21Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9772</id>
<created>2008-05-09T19:36:21Z</created>
<summary type="text/plain">In his keynotes presentation, James Gosling showed an impressive range of Java-based tools, technologies and gadgets.</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>
<dc:subject>JavaOne</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<iframe src="http://rcm.amazon.com/e/cm?t=wakaconsltd-20&o=1&p=8&l=as1&asins=0596527934&fc1=000000&IS2=1&lt1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;float:right;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
<p>This morning, James Gosling gave his traditional keynotes speech, with a series of impressive and entertaining demonstrations. What came across was the vast range of in which Java is being used. From online gaming to 3D graphics on mobile phones, from Smart Cards to particle accelerators at the CERN, from intelligent pens to robotic cars and power stations, Java is being used absolutely everywhere.
</p>

<p>A few examples at random. A demonstration of TOMMY Junior, a robotic car designed to be able to drive 100km across a busy city all by itself. <a href="http://www.callofthekings.com">Call Of The Kings</a>, a 3D online game written using the Project Dark Star Java Gaming libraries. An instrumentation gadget called the Sentilla motes, which are used to instrument anyting from cargo (to keep track of where they are), bridges (for stress), planes (to know when they need maintenance) and beer coasters (to know when the beer glass is empty!
</p>

<p>But one of the coolest geeky gadgets of the show would have to be the Pulse SmartPen from LiveScribe. This is a pen (Java-powered, of course) that not only records what you write, but can also record sound as you write, and match up the sound with the writing later on. So, if your listening to a presentation, you take some notes and record what the speaker is saying. Later, you go back and tap somewhere in your notes, and the pen plays what the speaker was saying at this time! Very cool for presentations and meetings! You can also load the data onto your PC, and consult both the written notes and the sound, and even share your notes on a web server in Flash.  You can even write your own Java applications to run on the pen. This is one seriously cool pen! And yes, I got myself one ;-).
</p>

<p>
On the subject of running application on other plaforms: on the plane coming over, the crew seemed to be having some trouble with the inflight entertainment system. For some reason, it kept freezing and they had to reboot it. As it rebooted, the crew made an announcement, asking people not to press the buttons too quickly, as this tended to make the system crash. As it rebooted, I couldn't help but noticing on the screens: Windows CE... ;-).
</p>]]>

</content>
</entry>
<entry>
<title>JavaOne 2008 - some photos</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/05/javaone_2008_so_1.html" />
<modified>2008-05-09T11:44:03Z</modified>
<issued>2008-05-09T11:41:52Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9761</id>
<created>2008-05-09T11:41:52Z</created>
<summary type="text/plain">A few photos to give the general feel of this year&apos;s JavaOne.</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<p>This being my first JavaOne, I wanted to share a few photos to give readers some general impressions.
</p>
<p>
JavaOne takes place in the Moscone center in downtown San Francisco.
</p>
<p>
<p><img alt="queue.JPG" src="http://weblogs.java.net/blog/johnsmart/archive/moscone-center.JPG" width="400" height="300" />
</p>

<p>
Coming into JavaOne through the main hall...
</p>
<p><img alt="queue.JPG" src="http://weblogs.java.net/blog/johnsmart/archive/main-hall.JPG" width="400" height="300" />
</p>

<p>
The first thing to say is that there are <em>lots</em> of people. Hmmm, I'm not sure I made that clear: there are <strong><em>lots</em></strong> of people.
</p>
<p><img alt="queue.JPG" src="http://weblogs.java.net/blog/johnsmart/archive/main-hall-2.JPG" width="400" height="300" />
</p>

<p>
A typical session - this is Josh Bloch taking about <a href="http://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683/ref=sr_1_1?ie=UTF8&s=books&qid=1210326467&sr=1-1">Effective Java</a>. This was a good talk, with some useful tips on how to use generics properly and some best practices for enums. Low level and very technical.(My phone may have Java on it, but it still takes crappy photos in a dim conference room):
</p>
<p><img alt="queue.JPG" src="http://weblogs.java.net/blog/johnsmart/archive/josh-bloch.JPG" width="400" height="300" />
</p>

<p>
I don't know if I mentioned it, but at JavaOne, there are <strong><em>lots</em></strong> of people. I take my hat off to the people who hold the little round signs with the session numbers on them, to tell you where to line up for each session. Honestly I don't know how they do it. They just yell things like "Session 104 - just go down the corridor and snake around like an S, then back this way..." - it might not sound much, but I think it must take a lot of visual-spacial skill to get it right with multiple lines of several hundred people criss-crossing in a confined space.
</p>
<p><img alt="queue.JPG" src="http://weblogs.java.net/blog/johnsmart/archive/queue.JPG" width="400" height="300" />
</p>

<p>
And the lines go on, and on, and on...
</p>
<p><img alt="queue.JPG" src="http://weblogs.java.net/blog/johnsmart/archive/queue-3.JPG" width="400" height="300" />
</p>

<p>
And on...
</p>
<p><img alt="queue-4.JPG" src="http://weblogs.java.net/blog/johnsmart/archive/queue-4.JPG" width="400" height="300" />
</p>

<p>
Oops, how did that photo slip in here ;-)? Seriously, this photo is actually the first time I've seen <a href="http://www.amazon.com/Java-Power-Tools-Ferguson-Smart/dp/0596527934/ref=pd_ts_b_52?ie=UTF8&s=books">Java Power Tools</a> on the shelves (I'm not counting Amazon, they were selling "New and Used copies" before I'd even got my copy!)
</p>
<p><a href="http://www.amazon.com/Java-Power-Tools-Ferguson-Smart/dp/0596527934/ref=pd_ts_b_52?ie=UTF8&s=books"><img alt="queue.JPG" src="http://weblogs.java.net/blog/johnsmart/archive/jpt-on-the-sheves.JPG" width="400" height="300" /></a>
</p>

<p>What doesn't come across in the photos is the networking side of things. I've met up with heaps of people that I've only previously known through email, and, despite all the high tech stuff, nothing really does beat face-to-face communication.
</p>]]>

</content>
</entry>
<entry>
<title>JavaOne 2008 - FindBugs is a great little tool, and it just keeps getting better!</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/05/javaone_2008_fi.html" />
<modified>2008-05-09T01:23:32Z</modified>
<issued>2008-05-09T01:23:09Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9751</id>
<created>2008-05-09T01:23:09Z</created>
<summary type="text/plain">There are a lot of static analysis tools out there, but Findbugs is unique. Where Checkstyle will raise 500 issues, and PMD 100, FindBugs will only raise 10 - but you damn well better look at them carefully! </summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>
<dc:subject>Community: Java Tools</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<iframe src="http://rcm.amazon.com/e/cm?t=wakaconsltd-20&o=1&p=8&l=as1&asins=0596527934&fc1=000000&IS2=1&lt1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;float:right;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
<p>
There are a lot of static analysis tools out there, but Findbugs is unique. Where Checkstyle will raise 500 issues, and PMD 100, FindBugs will only raise 10 - but you damn well better look at them carefully! 
</p>

<p>
That is a slight over-simplification, but it does reflect the philosophy of FindBugs. FingBugs uses more sophisticated analysis techniques than tools like PMD and Checkstyle, working at the bytecode level rather than with the source code, and is more focused on finding the most high priority  and potentially dangerous issues.
</p>

<p>
At JavaOne this year, I've listened to both of William Pugh's excellent presentations on FindBugs. He ran through some interesting bugs that FindBugs found in some real-world code, and shared some useful tips on using FindBugs for very large real-world projects. For example, he suggested ignoring the low-priority issues (but not the medium-prioruty ones, which contain some very useful rules), and concentrating <em>only</em> on the issues that have appeared since the last stable release. Indeed, FindBugs has the ability to compare two sets of bugs and figure out which ones are new.
</p>

<p>
One interest area that he mentioned was that of annotating issues. When you review an issue in the FindBugs GUI tool, you can add an annotation such as "Mostly harmless" or "Should fix", along with a comment. This feature will soon also be available in the Eclipse plugin. This is cool. However, at the moment, it's hard to share this information, as it is stored in a local XML file. One interesting evolution that is apparently in the pipelines is to allow you to store these annotations in an external location, such as in a database. This would mean that developers could safely share annotations and comments on the same bug, which would make bug reviewing and correcting that much easier.
</p>

<p>
Another interesting evolution is in the area of reviewing and closing FindBugs issues. In PMD, for example, you can tell the analyser to ignore a particular issue using annotations or comments. This is a useful feature, more convenient than the current FindBugs approach which involves configuring XML configuration files. FindBugs works on bytecode, not on source code, so comments are obviously not an option. However, William indicated that using annotations to suppress Findbugs issues is definitely on the cards for a future release.
</p>

<p>Note that FindBugs is not really a competitor with tools like PMD and Checkstyle - the tools are really at opposite ends of the static analysis tools spectrum. In many places where I've worked, there is a strong drive for imposing coding standards, and this is where a tool like Checkstyle excels. With a correctly configured Eclipse environment, 90% of formatting errors will often dissapear with an automatic reformat. FindBugs, on the other hand, is strongly focused on potential programming errors. The tools are really quite complementary.
</p>

<p>
And now for the shameless plug - <a href="http://www.oreilly.com/catalog/9780596527938/?CMP=ILC-Home3&ATT=9780596527938">Java Power Tools</a> has a full chapter on FindBugs, as it is a <em>very</em> cool tool.
</p>
<p align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="468" height="60">

      <param name="movie" value="http://www.wakaleo.com/images/banner3.swf" />

      <param name="quality" value="high" />

      <embed src="http://www.wakaleo.com/images/banner3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed>

</object></p>]]>

</content>
</entry>
<entry>
<title>JavaOne 2008 - towards user interfaces that rock!</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/05/javaone_2008_to_1.html" />
<modified>2008-05-08T15:35:58Z</modified>
<issued>2008-05-08T15:21:21Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9747</id>
<created>2008-05-08T15:21:21Z</created>
<summary type="text/plain"> Enhanced user experience is a key theme coming out of this year&apos;s JavaOne. There are countless sessions on innovative technologies such as JavaFX, the Google Web Toolkit, Comet, and Android. All of these have in common that they are...</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<iframe src="http://rcm.amazon.com/e/cm?t=wakaconsltd-20&o=1&p=8&l=as1&asins=0596527934&fc1=000000&IS2=1&lt1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;float:right;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>

<p>
Enhanced user experience is a key theme coming out of this year's JavaOne. 
There are countless sessions on innovative technologies such as JavaFX, the Google Web Toolkit, Comet, and Android. All of these have in common that they are Java-based technologies that allow you to create enhanced user experiences without all the hard work. Well, with less hard work than if you had to code it all yourself :-).
</p>
<p>
JavaFX is a high-level scripting language that lets you create extremely visual browser-based user interfaces. The Google Web Toolkit (in which you build an AJAX-enabled Javascript web interface using Java classes that any old Swing developer will feel at home with. Comet is a technology that enables the server to update the user's web page automatically whenever required, with no intervention on the part of the user and little network overhead.
</p>

<p>
If you believe sun, this is clearly the way of the future. It's a shame that some government organisations still refuse themselves these technologies, on the basis that they (or at least, the AJAX-based ones) require Javascript, and, in theory at least, not all users have Javascript activated on their browsers. I guess they'll learn with time...
</p>
<p align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="468" height="60">

      <param name="movie" value="http://www.wakaleo.com/images/banner3.swf" />

      <param name="quality" value="high" />

      <embed src="http://www.wakaleo.com/images/banner3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed>

</object></p>]]>

</content>
</entry>
<entry>
<title>JavaOne 2008 - some brand new monitoring and profiling tools for your Java apps</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/05/javaone_2008_so.html" />
<modified>2008-05-08T05:24:35Z</modified>
<issued>2008-05-08T05:24:27Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9743</id>
<created>2008-05-08T05:24:27Z</created>
<summary type="text/plain">Performance monitoring and profiling applications is one of my favorite pet topics. So I was keen to here today&apos;s talk on &quot;Improving Application Performance with Monitoring and Profiling Tools&quot;.</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>
<dc:subject>Community: Java Tools</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<iframe src="http://rcm.amazon.com/e/cm?t=wakaconsltd-20&o=1&p=8&l=as1&asins=0596527934&fc1=000000&IS2=1&lt1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;float:right;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>

<p>
Performance monitoring and profiling applications is one of my favorite pet topics - indeed, there's a big chapter on tools in this area in <a href="http://www.oreilly.com/catalog/9780596527938/?CMP=ILC-Home3&ATT=9780596527938">Java Power Tools</a>. So I was keen to here what Jaroslav Bachirik and Gregg Sporar had to say in their talk today, entitled "Improving Application Performance with Monitoring and Profiling Tools". 
</p>
<p>
It was worth it. Naturally, they talked about the JDK tools such as jps, jinfo, jhat, and JConsole, and the Solaris-specific tool DTrace. JHat got a special mention as being the only tool to date capable of diagnosing permheap issues. 
</p>
<p>
The NetBeans profiling tools, which are very good, were also discussed. NetBeans has powerful and smoothly integrated profiling features built right in to the IDE, which makes it very pleasant tool to use for profiling and performance tuning. 
</p>
<p>
But there's more. They also discussed <a href="https://btrace.dev.java.net/">BTrace</a>, a new tool for dynamically tracing a running Java application. It uses a fairly AOP-style approach where you write a script to indicate which classes and methods you are interested in monitoring. The script is actually a simple annotated Java class. For example, in the following code (shamelessly stolen from the BTrace documentation ;-) ), you set up a call-back method (func()) that will be called whenever the Thread.start() method is called:
<verbatim>
<pre>
@BTrace
public class HelloWorld {
 
    // @OnMethod annotation tells where to probe.
    // In this example, we are interested in entry 
    // into the Thread.start() method. 
    @OnMethod(
        clazz="java.lang.Thread",
        method="start"
    )
    public static void func() {
        // println is defined in BTraceUtils
        // you can only call the static methods of BTraceUtils
        println("about to start a thread!");
    }
}
</pre>
</verbatim>
</p>

<p>
Then you simply run BTrace against your running Java process. Easy!
</p>

<p>
The other new and interesting tool they mentioned is <a href="https://visualvm.dev.java.net/">VisualVM</a>, a very cool new profiling tool being developped at Sun. Visual VM (just out as an RC) gives you a high level, graphical overview of profiling data and statistics, and letting you drill down for more details about memory consumption or thread use, or to display graphs indicating the methods that your application is spending the most time executing. You can't drill down to the line level the way you can in the NetBeans profiler, but, still, it's a pretty neat tool.
</p>

<p align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="468" height="60">

      <param name="movie" value="http://www.wakaleo.com/images/banner3.swf" />

      <param name="quality" value="high" />

      <embed src="http://www.wakaleo.com/images/banner3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed>

</object></p>]]>

</content>
</entry>
<entry>
<title>JavaOne 2008 - Hudson wins the 2008 Duke&apos;s Choice Award</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/05/javaone_2008_hu.html" />
<modified>2008-05-07T03:41:44Z</modified>
<issued>2008-05-07T03:36:46Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9722</id>
<created>2008-05-07T03:36:46Z</created>
<summary type="text/plain">Hudson wins the 2008 Duke&apos;s Choice Award in the &quot;Developer Solutions&quot; category.</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<iframe src="http://rcm.amazon.com/e/cm?t=wakaconsltd-20&o=1&p=8&l=as1&asins=0596527934&fc1=000000&IS2=1&lt1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;float:right;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
<p>
I like the Dukes Choice Awards. They have to be the most unashamably geeky awards in the industry. Indeed, the Dukes Choice Awards recognize "cool tools, technologies, and products". This appeals to my inner geek enormously, and so I find it very cool.
</p>
<p>
Anyway, this year, the Dukes Choice Awards has chosen one of my personal favorites for the "Developer Solutions" category, the <a href="https://hudson.dev.java.net/">Hudson</a> Continuous Integration tool. Hudson is a relatively young tool, but it has been progressing at a phenomenal rate over the last year or two. Installation and configuration is a breeze, and there are an impressive number of plugins for extra features, including some very cool plugins for reporting on test results, code coverage, and code metrics. 
</p>
<p>
The only downsides in the current version is that security is a bit limited (but getting better), and you don't get the sort of fancy pre-emtive builds that TeamCity offers. But it's very easy to get up and running quickly. If you're choosing a CI server, you definately should take a look at Hudson.
</p>]]>

</content>
</entry>
<entry>
<title>JavaOne 2008 - Subversion 1.5 is coming!</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/05/subversion_15_i.html" />
<modified>2008-05-07T03:03:28Z</modified>
<issued>2008-05-07T02:55:18Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9721</id>
<created>2008-05-07T02:55:18Z</created>
<summary type="text/plain">The new version of Subversion, Subversion 1.5, is due out any day now, and it comes with some features that rock!</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>
<dc:subject>Community: Java Tools</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<iframe src="http://rcm.amazon.com/e/cm?t=wakaconsltd-20&o=1&p=8&l=as1&asins=0596527934&fc1=000000&IS2=1&lt1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;float:right;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
<p>This morning, I went to a talk by some of the CollabNet guys on the now-imminent release of Subversion 1.5. I've talked about some of the main new features, notably the new merge tracking capabilities, <a href="http://www.javaworld.com/javaworld/jw-01-2008/jw-01-svnmerging.html">elsewhere</a>, so I won't rehash them here. However, there were a few other interesting new features that are worth mentioning.
</p>
<p>
To have a truly robust enterprise Subversion archtecture, you need some kind of replication. Backup servers in case your main repository dies a violent death. 
</p>
<p>Another big reason to have some kind of replicated architecture is for performance. If some of your users are geographically a long way from the main repository, access times can be much slower than for a server that is physically closer.
</p>
<p>
In Subversion 1.5, if you are running Subversion through Apache, you can at least address the second issue very easily. By using a feature called "Write-through proxying", you can set up a master Apache repository in one location, and a series of Apache slave servers distributed across your sites. The slave servers are basically read-only copies of the master repository. Any read-only requests (such as "svn update") will stop at the nearest slave server. Read-write requests (such as "svn commit") are transparently passed on to the master server. The master server takes care of updating the slave servers automatically using the svn_sync tool.</p>

<p>Setting this up isn't too complicated. You need to configure the Apache slaves using a special directive to point to the master server, and also configure them to accept updates from (and only from) the master server. Then you set up replication from the master to the slaves using svn_sync. 
</p>
<p>Note that for this to work, you need to be running Subversion 1.5 with Apache 2.2 with mod_proxy - you can't do it with svnserve.</p>
<p>
This is a good solution for improving performance, and a partial solution for server redundency. For example, if the master server fails for some reason, no one will be able to commit their changes, but updates still will be possible.
</p>]]>

</content>
</entry>
<entry>
<title>CommunityOne 2008  - Slides avaliable for &quot;Open Source Tools for Optimizing Your Development Process&quot;</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/05/communityone_pr.html" />
<modified>2008-05-07T03:04:24Z</modified>
<issued>2008-05-07T02:16:20Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9694</id>
<created>2008-05-07T02:16:20Z</created>
<summary type="text/plain">I gave a talk today at CommunityOne on &quot;Open Source Tools for Optimizing Your Development Process&quot;. You can now get the slides for this presentation online.</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>
<dc:subject>Community: Java Tools</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<iframe src="http://rcm.amazon.com/e/cm?t=wakaconsltd-20&o=1&p=8&l=as1&asins=0596527934&fc1=000000&IS2=1&lt1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;float:right;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>

<p>Today, I gave a talk at <a href="http://developers.sun.com/events/communityone/index.jsp">CommunityOne on "Open Source Tools for Optimizing Your Development Process"</a>. The abstract for the talk is as follows: 
</p>
<em>
<p>
One of the nice things about development on the Java™ platform is the number of productivity-enhancing tools available. Indeed, an appropriate mix of tools and best practices can do wonders for your development process.
</p>
<p>
This session covers some key areas in which proper use of appropriate tools can enhance your development process. These areas include build tools such as Ant and Maven; continuous integration tools such as Cruise Control, Continuum, and Hudson; code quality tools such as Checkstyle, PMD, and FindBugs; testing tools such as JUnit 4 and TestNG; and test coverage tools such as Cobertura. The presentation also looks at tools, such as UmlGraph, that can automatically generate technical documentation. Finally, perhaps more importantly, it examines how to integrate all of these products together in a way that can streamline development work and dramatically optimize your development process.
</p>
</em>

<p>
The talk, naturally, discusses some of the topics covered in the <a href="http://www.oreilly.com/catalog/9780596527938/?CMP=ILC-Home3&ATT=9780596527938">Java Power Tools</a> book. You can get the slides <a href="http://www.wakaleo.com/resources/communityone.pdf">here</a>. Because of the scope and the limited presentation time, the slides cover the material at a fairly high level. On the other hand, now that I've covered the basics, I'll be able to do some more detailed talks on specific areas. Stay tuned! 
</p>

<p>One person made an interesting comment, along the following lines:
When you commit your broken code to the server, you've already broken the build and placed a broken revision in version control - why not prevent the broken revision from being committed in the first place? This is a good point, and in my opinion the next must-have feature for  any CI tool that respects itself. Intercept the commit before it gets to your version control system, run a pre-emptive build on the merged code, and refuse to commit if anything goes wrong. 
</p>
<p>
Nice idea. Probably quite tricky to implement in practice. Currently, as far as I know, TeamCity is the only tool that does anything like this, though I believe the Hudson developers are thinking about how to do this too. TeamCity basically acts as a proxy between you and your version control system, and tests the build before commiting your changes. 
</p>]]>

</content>
</entry>
<entry>
<title>An ode to JavaOne</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/04/an_ode_to_javao_1.html" />
<modified>2008-04-30T20:46:18Z</modified>
<issued>2008-04-30T11:16:15Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9642</id>
<created>2008-04-30T11:16:15Z</created>
<summary type="text/plain">With JavaOne coming up next week, I thought this little tribute might be approriate.</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<div>
<p>
With JavaOne coming up next week, I thought this little tribute might be approriate.</p>

<h3>The Coder</h3>
<p>
<em>To the tune of 'The Gambler', by Kenny Rogers</em>
</p>
<p>
<pre>
On a warm summers evenin', on a plane bound for nowhere,
I met up with the coder; we were both too tired to sleep
So we took turns a surfin' techie website on our laptops
til boredom overtook us, and he began to speak

He said, son, I've made a life out of Java Server Faces
Of Hibernate and POJOs, of webapps portalized
So if you don't mind my sayin', you've made a mess of those use cases
If you let me use your keyboard, Ill give you some advice

So I handed him my keyboard, and he asked about my project
Then he flicked through my classes, and asked for some insight
And the night got deathly quiet, and his face lost all expression
Said, if you're gonna cut the code, boy, ya gotta learn to cut it right

You got to know when to mock 'em, know when to code 'em
Know when to unit test, and know when to scrum
You never count your stories till you've done your iteration
There'll be time enough for counting when the sprint is done

Now every coder knows that the secret to survivin'
Is keepin' your code agile, and keepin' your code clean
Cause requierments are a changin', and those change requests are coming
And the best that you can hope for is to keep the users keen

So when he'd finished speakin', he passed me back the keyboard
Taught me to refactor, JUnit and TDD
Continuous Integration, testing annotations,
And how to measure progress by results that you can see.

You got to know when to mock em, know when to code em
Know when to unit test, and know when to scrum
Don't you go believing that requirements are frozen
Even the users, they won't know 'em till the sprint is done

You got to know when to mock em, know when to code em
Know when to unit test, and know when to scrum
Don't get caught up read Dilbert when your doing pair programming
There'll be time enough for Dilbert when the sprint is done
</pre>
</p>
<p>
So now you can go vote for yours truly in the <a href="http://www.itrockstar.co.nz/">New Zealand IT Rockstar competition</a> ;-).
</p>
</div>
<p align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="468" height="60">

      <param name="movie" value="http://www.wakaleo.com/images/banner3.swf" />

      <param name="quality" value="high" />

      <embed src="http://www.wakaleo.com/images/banner3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed>

    </object></p>
]]>

</content>
</entry>
<entry>
<title>Vote for your favorite New Zealand IT Rockstar</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/04/vote_for_your_f_1.html" />
<modified>2008-04-29T09:41:36Z</modified>
<issued>2008-04-29T09:41:30Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9630</id>
<created>2008-04-29T09:41:30Z</created>
<summary type="text/plain">Vote for your favorite New Zealand IT Rockstar - or if you don&apos;t know anyone else, vote for yours truly ;-).</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<p>To my surprise, I've been nominated in the top 10 finalists for the <a href="http://www.itrockstar.co.nz/">New Zealand IT Rockstar competition</a>. Some come along and vote! 
</p>
<p>By the way, watch this space, there'll be a Selenium slideshow coming up for JavaWorld pretty soon, as well as some serious blogging for JavaOne next week. Keep tuned!
</p>]]>

</content>
</entry>
<entry>
<title>Java Power Tools is now available!</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/04/java_power_tool_10.html" />
<modified>2008-04-25T12:42:54Z</modified>
<issued>2008-04-25T12:42:48Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9604</id>
<created>2008-04-25T12:42:48Z</created>
<summary type="text/plain">Java Power Tools is now available!</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<iframe src="http://rcm.amazon.com/e/cm?t=wakaconsltd-20&o=1&p=8&l=as1&asins=0596527934&fc1=000000&IS2=1&lt1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;float:right;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>

<p>
After a bit of a wait, <a href="http://www.oreilly.com/catalog/9780596527938/">Java Power Tools</a> has been finally released! <em>Java Power Tools delivers 30 open source tools designed to improve the development practices of Java developers in any size team or organization. Each chapter includes a series of short articles about one particular tool - whether it's for build systems, version control, or other aspects of the development process - giving you the equivalent of 30 short reference books in one package.</em> Actually, there are more than 30 tools, as some chapters talk about more than one tool. But who's counting :-).
</p>

<p>
Amazon promise to have it in stock on the 3rd of May. The source code will be on the <a href="http://www.wakaleo.com/java-power-tools">book website</a> real soon. Thanks again to everyone who contributed articles or who helped out in many other ways!
</p>]]>

</content>
</entry>
<entry>
<title>Slides from my Software Quality NZ talk on &quot; Java Software Quality - Tools and Techniques&quot; are now online</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/johnsmart/archive/2008/04/slides_from_my.html" />
<modified>2008-04-23T23:12:56Z</modified>
<issued>2008-04-23T23:12:27Z</issued>
<id>tag:weblogs.java.net,2008:/blog/johnsmart/358.9595</id>
<created>2008-04-23T23:12:27Z</created>
<summary type="text/plain">Slides from my Software Quality NZ talk on &quot; Java Software Quality - Tools and Techniques&quot; are now online.</summary>
<author>
<name>johnsmart</name>

<email>jfsmartemail-onjava@yahoo.com.au</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/johnsmart/">
<![CDATA[<iframe src="http://rcm.amazon.com/e/cm?t=wakaconsltd-20&o=1&p=8&l=as1&asins=0596527934&fc1=000000&IS2=1&lt1=_blank&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr" style="width:120px;height:240px;float:right;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>

<p>Recently I did a talk for Software Quality NZ on "Java Software Quality - Tools and Techniques". The slides for this talk are now online: check them out <a href="http://www.wakaleo.com/news/39-news/128-java-software-quality-tools-and-techniques">here</a>.
</p>

<p>
This talk is a fairly high-level coverage of a wide range of tools, from a QA perspective. Here's the summary:
</p>
<em>
<p>
Software quality metrics are good. Automated software quality metrics are better. John Smart, author of the about to be released book "Java Power Tools", will discuss a number of open source tools that can automate code quality and test coverage reporting to your project, and how to integrate them into your development process.
</p>

<p>More importantly, John will cover how these tools can be used to reduce bugs, speed up delivery, improve the quality of your project, and hone your team's skills. In this presentation, John will be discussing tools such as Checkstyle, PMD, FindBugs, Crap4j, Cobertura and Selenium, and looking at quality metrics in the real world - how they work best as a team learning tool, and poorly as a measure of individual performance.
</p>
</em>

<p align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="468" height="60">

      <param name="movie" value="http://www.wakaleo.com/images/banner3.swf" />

      <param name="quality" value="high" />

      <embed src="http://www.wakaleo.com/images/banner3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed>

    </object></p>

]]>

</content>
</entry>

</feed>