Thursday, May 8, 2008

Java One 2008, day one, part two

Where was I? Ah the JAX-RS presentation. A few more things have come to mind since I finished that post. With JAX-RS you end up wanting to wrap your domain model element rather than liter them with JAX-RS annotations and structures. There appears to be a wizard to do this for you in Netbean; but not command line tool to make this sharable from other platforms.

The afternoon general session was more JavaFX stuff, looks to be an interesting technology when it finally arrives. Would appear to make it possible to a lot of nice graphical stuff for very little work. Fortunately those API are also going to be avaliable to the normal java developer as it is all based on the same VM. They showed a cool demo of Parleysport of JavaFX from its current flash implementation. Very impressive, very rich might even stand a change against Silverlight... specially with the JDKu10 release which will improve the user experience in many ways. And it is about time too!

Oh and a bit about packaging, going to support OSGi aswell as an new Java packaging standard called JAM. Should make a few people very happy.

The next presentation for me was TS-6169 which covered the new feature in spring 2.5. I wont go into all the details here as there is a fine artical here but sufficive to say it looks as clean and powerful as ever. A lot more annotations in this release mean that there is rather less of a need for the big old spring configuration files.

Interesting figures at the start of the slide showing that apparently the vast majoriy of BEA users have spring in the mix. Although to be fair any user of SOA 11 will be using spring, they just wont know about it. (The innards of SOA are put together using spring there are even a few aspects in there)

There appears to be a trend of annotations on annotations. In particular in the basis of providing marked to wire stuff up. This was also seen it the WebBeans presentation which I have seen [sic] tommorrow.

Final note is that Spring 3.0 will be a bit restfull, will be rolled out to the entire platform.

TS-6589 turing WTF code into a learning experience was presented by one of the developers in find bugs. Showed some common examples, for example synchronizing on a string constant or that DateFormat is never thread safe, but looked more at the process of trying to abstract out the programmer error. Interesting they say that writing test for findbugs is quite hard but they will write one for you if you come up with a suitable example. (They did say that writing tests in PMD and jackpot is much easier)

A section on equals methods was interesting as it presented the following three options for implementing the equals method: object equality, value equality or behavioural equality. The single equals method is not expressive enough. Indeed I can see the point here that This should never have been part of the API; but instead a seperate comparator interface for each case.

TS-6127 looked at a DIY implementation of a multitouch "table". Lots of good stuff about wood work and how to get a webcam to see in IR. Really quite fun. An interesting if obvious point is that you have to track the order of the fingers in order to do much of the gesture recognition for multitouch. So even if you rotate a figure the order of the "touches" has to stay the same in order to make the UI work properly. Not much new; but fun to hear how it was made.

BOF-5031 was a follow on from an earlier presentation, TS-5581. I liked the new annotations on of other elements proposal, JSR-308. This allows the use of declarative constraints such as @Immutable and @NotNullable which can be enforced by the compiler, those are described in JSR-305. The safe rethrow looks also quite useful, it is best explained with the code from the presentation seen below. If you want to log all exceptions when they go past you have a problem as you cannot rethrow Throwable without having to expose them in the throws clause:

void m() throws X1,X2 {
  try { /* Something that can throw X1,X2 */ }
  catch (Throwable e) {
   logger.log(e);
   throw e; // Error: Unreported exception Throwable
  }
}

Instead with the use of the final keyword you can tell the compiler that this is okay and to pass it on:

void m() throws X1,X2 {
  try { /* Something that can throw X1,X2 */ }
  catch (final Throwable e) { // Not extra final keywork
   logger.log(e);
   throw e; // Compiles OK; can throw X1,X2
  }
}

Very usefull because it means that you can register stuff like OutOfMemory errors and close transactions without having to muck up the API or use that sun.misc.Unsafe class.

No mention of closures though....

The last BOF of the day, 5613, focused on JAX-RS. I am pretty sure it was interesting; but I think I was very sleepy at this stage and appear to not to have taken any notes. Still it was after 9pm after a early start and a flight from Scotland via London. Back to the hotel for some well earned rest.

No comments: