Joe Walnes
  Blog



Recent Entries

New blog: http://joewalnes.com

Creative uses of Hamcrest matchers

Hamcrest 1.1 released

Testing on the Toilet

Building testable AJAX apps (Does my button look big in this?)

QDox is back - 1.6 released

Java and .NET RESTful interoperability with XStream

I've joined Google

OSCon: SiteMesh, SiteMesh, SiteMesh, SiteMesh

Flexible JUnit assertions with assertThat()

SiteMesh and Content Management @ O'Reilly OpenSource Conference

XStream 1.1.2 released. Java 5 Enums, JavaBeans, field aliasing, StAX, and more...

VB.Net is the bestest

XStream 1.1.1 released

Accessing generic type information at runtime

XStream 1.1 released

JUnit tip: Setting the default timezone with a TestDecorator

XStream: how to serialize objects to non XML formats

How my backflip went...

Backflippin' in 4 hours.

Is 100% test coverage a BAD thing?

Looking back at the SiteMesh HTML parser

The road ahead for SiteMesh 3

Joe's Backflipping for Autistic Research - time is nearly up...

SiteMesh 2.2 Released

More... [RSS | RDF]

About Joe Walnes

I am a software engineer for Google, based in London.

Open Source

WebStuff (coming soon)

XStream

ActiveMQ

SiteMesh

QDox

nMock

jMock

Pico Container

Nano Container

OpenSymphony

Squiggle

MockDoclet

MockObjects

Jelly

Groovy

PatternStitcher

XJB

Books

Java Open Source Programming, Wiley JSP Site Design, Wrox

Talks

Mock Roles, not Objects
October 26 2004, Vancouver, Canada. OOPSLA'04

Personal Development Practices Map
June 24 2004, Salt Lake City, Utah. Agile Development Conference

SiteMesh.NET and ASP.NET MasterPages
May 20 2004, Bangalore, India. Bangalore .NET User Group

Mock Objects: Driving Top Down Development
March 29 2004, St Neots, UK. OT2004

Mock Objects
December 2 2003, London, UK. XP Day 3


OT2004 : Taming the Tiger (Java 1.5)

This session was presented by Benedict Heal, and he was brilliant; concise, clear, humourous and extremely chilled out. Even the fact that Josh Bloch was listening in on his presentation didn't phase him.

Most of the new Java 1.5 features are already widely known. Generics, annotations, auto-boxing, enums, syntactic sugar, yada yada yada.

Some things that caught my eye:

  • -Xlint : a compiler flag to warn you when your code can be improved to take advantage of new features such as generics.
  • Generics are not available at runtime (unlike C#).
  • Use of generics all over the API, not just collections. For example, Class is a genericised type, so newInstance() returns the correct type.
  • List<MyThing> cannot be given a List<ExtendedMyThing>. Makes sense really as otherwise you'd be able to add things that it shouldn't allow.
  • Genericised types can be constrained to only allow certain type. class Blah<T extends MyThing>.
  • Wildcards allow even more flexibility: List<? extends MyThing> list = new ArrayList<ExtendedThing>() // valid.
  • Or this: List<? super ExtendedThing> list = new ArrayList<MyThing>(); // valid
  • Generics are complicated :)
  • Annotations can be specified as source level, class level (available for inspection by class loader) or runtime level (available through reflection).
  • Variable parameters to a method. Defined like this: printf(String format, Object... args). The three dots are part of the syntax! Called like this: out.printf("Blah blah blah", 44, "hello", someObject). Note autoboxing comes into play too.

It's only a shame there isn't a feature such as the anonymous delegate in C#... now that is real power. Rock on Java 1.8.

Comments

jez

Yeah, Benedict rocks! He did one of the best jsig.com presentations so far, a couple of years ago ( http://209.235.197.109/seminars/2002/London/14May2002.html )

Thanks for all the updates on the OT Conference, they've been cool joe.

Keith Lea

You should fix your angle brackets in #4

ben

Tsk tsk, Joe... an XML guru like yourself putting in bare angle brackets instead of the appropriate entities... ;-) (i.e. all your generics examples above aren't coming through the html...)

Joe Walnes

D'oh! Thanks for pointing that out, Ben.

Name:
Email:
URL:

ThoughtBloggers

Martin Fowler

Dan North

Aslak Hellesoy

Darren Hobbs

Geoff Oliphant

Mike Roberts

Chris Stevenson

Jon Tirsen

Loads More...

Agile Bloggers

Ken Arnold

Ward Cunningham

Brian Marick

Robert Martin

Bret Pettichord

Java Bloggers

Ara Abrahamian

Mike Cannon-Brookes

Vincent Massol

Bob McWhirter

Rickard Oberg

Joseph Ottinger

James Strachan

Hani Suleiman

Communities

eXtreme Tuesday Club (XTC)

Thursday GeekSpeek

ThoughtWorks GeekNight

London Java Meetup

The Codehaus

[RSS | RDF]
© 2001-2004, Joe Walnes

Powered by SiteMesh and Moveable Type.