I got the privilege of attending JavaOne 2010, and here are some of the highlights of the technical sessions I attended. These are mostly either sessions to try to catch later, or frameworks that I'd like to give a good look to put in our technical stack.
This session was both a look at JSR 310 (which Steven expects to be in JDK8 at this point) and a look a joda-time as a solution for "today". He went over the design decisions made, how most of his classes are immutable and why, and how some things in joda-time are not flexible and how they're fixing that in JSR310. Overall most of the flexibility not allowed by joda-time is for special cases and not likely to be needed by most people. They are building lots of flexibility into JSR310, but always providing sensible defaults.
My takeaway from this was something that I already knew, but haven't got around to doing. Start using joda-time and look forward to a JDK where java.util.Date and java.util.Calendar are no longer the preferred way of handling date/times (although according to Steven they won't be deprecated because Oracle says not to).
Besides being a Java Posse fanboy, I wanted to go to this talk to see some scala and see what he had to say about adding some functional aspects to java code. Overall the talk was a little too much about the domain (genetics) and not enough code. But, the one takeaway I got from this is google collections (now called guava) is something we need to start using, and there are not only a bunch of nice new collections, but also some nice functional additions to working with collections (Predicates, Functions, etc). And of course at the end of this talk he reduced the 20 lines of java code down to 1 line of scala - but he cheated a bit by in-lining a bunch of calls on the scala side.
This was my favorite talk of the week. I knew almost nothing of clojure going in, and still now about the same amount. But, what I really liked was Rich's definition of state, how he defined it in terms of values (immutable) and a point in time. Once you go down that path you see how you never can safely define state in a language like java once you accept that you can't stop time effectively. Given this premise, he went on to talk about how state is handled in clojure, which is a very functional, lisp-like language running on the JVM. He went over several approaches used in clojure: STM (software transactional memory), references, and agents. All were different in their semantics, but had a similar looking API (shape of API) so they can be exchanged very quickly without much change to the callee. Overall I thought this talk was great just because it made me think about things in a way I've never thought about them in a programming sense. I highly recommend you watch/listen to this talk if it becomes available - I would guess Rich does it at several conferences if the javaone talk doesn't become available.
This was a mostly overview talk about beans validation, which is now standard in EE6 I think. He showed lots of examples of how to define validation in both annotations and XML. There were good examples here, and I think it's something worth looking into. I'd like to follow up and see if anyone's done a beans validation to jquery validation bridge, and if not, perhaps look into doing something at least with freemarker templates to get that done. It'd be real nice to define validation in a single place and get it on the client, server, JPA, etc all with the same set of rules. He showed how you can define groups and only run a subset if that makes sense (like for client side validation if there are some rules that aren't practical there...). This is another framework I need to look seriously at - even if it's not available on the client side in jQuery/dojo. I could still remove a bunch of java code and make those rules more declarative.
This talk had two interesting things to add to the quality of your unit tests. One, naming them using "Should", and test the intent of the code. Don't test the implementation, test the intent. So in his examples his test class was named "WhenYouCreateACell" and a test method was "aDeadCellShouldBePrintedAsADot" (testing the game of life). This way they read nice in reports, but you also force yourself not to think about testing the lines of code in the method under test, but instead testing some intent of your method. He also talked about using the AAA approach to unit testing: Arrange, Act, Assert. In this you always first setup your needed environment for the test (maybe mocking what you need to), do the action under test, and then have a SINGLE assertion. He talked about issues with multiple asserts at the end of test methods, and broke into a discussion about the library Hamcrest to improve assertions and string them together in a fluent API. The other interesting part of this talk was his examples of parametrized tests with junit 4.8.1. In these types of tests you can provide a matrix of data and have junit run through a single test method with all the data very quickly. He showed how to use this with XLS data, but then also how to apply it to selenium tests which was interesting.
So those were my highlights of the conference, and things I left wanting to investigate more. If you can get a hold of any of the above talks, I'd recommend watching/listening to them. I went to quite a few other talks, but these were my favorites.