Tuesday, May 26, 2009

Balsamiq Mockups

http://www.thinklocalsem.com/wp-content/uploads/2008/09/arrow-up.gif People who are involved in user interface development should definitely check out Balsamiq Mockups. I have successfully used the free online version, and would recommend the product for any project where UI design is involved.

Everybody interested in a Web 2.0 startup success story, should also have look at Balsamiq. Read this interview and this blog post.

Wednesday, May 20, 2009

GR8Conf Summary: Groovy, Grails and Griffon in Copenhagen

Update [2009-06-29]: The slides of the conference are available on slideshare.

A remarkable group of alpha-geeks have gathered the last two days in Copenhagen to attend the GR8 Conference.

GR8Conf was a small conference dedicated to Groovy, Grails and Griffon.

About 90 people were attending, the conference, which is quite a number considering that the main marketing channels were mailing-lists and twitter.

Twitter was also an amazing phenomena at the conference itself: The conference almost seemed to take place in two parallel universes: Copenhagen and tweety-land... during the sessions a lot of the attendees were constantly tweeting their impressions and reading the tweets of their fellow attendees that were sitting next to them in the same room. The traces of this reality-loop can be found at #gr8conf on twitter.

The first session was from Jonathan Felch about a project in Real-Time Computational Finance.
At least some knowhow from the financial trading business would have been a requirement to really understand this sessions. Nevertheless it was interesting to see how Groovy with its dynamic nature was able to provide a real benefit in a highly dynamic business environment.

In the second session Dierk König presented 7 usage patterns for Groovy in Java projects.
This was an interesting and very cunningly presented session.
The seven patterns had quite expressive names: Super Glue, Liquid Heart, Keyhole Surgery, Smart Configuration, Unlimited Openness, House-Elf Scripts and Prototype.
Two more patterns were announced: Lipstick and Ghost Writer.
When asked about Groovy anti-patterns, his response was: overuse of the each()-method on lists, overuse os mocks and overuse of DSLs.

In the third session Guillaume Laforge presented the novelties of Groovy 1.6. The content of the session was roughly the same as in the matching InfoQ article.
In my opinion the AST transformations / compile-time metaprogramming capabilities are the most ground-breaking new feature, which has a huge potential for upcoming innovation.

In the fourth session Graeme Rocher presented the novelties of Grails 1.1.

The main focus of this release were better integration of Grails into the Java ecosystem (e.g. Maven or Ant) and improvements in the Grails plugin system.

The fifth session was a presentation of Guillaume Laforge about domain specific languages in general and the specific language features that enable the realization of internal DSLs in Groovy.

After that Andrew Eisenberg gave a short demonstration of the upcoming Groovy plugin for Eclipse that is currently developed at SpringSource.

The first day then was concluded with a dinner in Copenhagen's Tivoli.

Day two started with two fast paced sessions by Graeme Rocher. Graeme once said on Twitter "some Java confs are like funerals" ... he proved the contrary in those two sessions. They were jaw-dropping and woke the impression that Grails is really the holy grail of web development ;-)

The first session was called "Building Twitter with Grails". It was basically the same content as Graeme's Webinar.
Even after having attended the Webinar, it was still very inspiring to see Graeme live. It's just very impressive to witness the creation of quite a sophisticated web application (including security, full-text search, caching, asynchronous communication over JMS and RSS support) in under one hour.
A particularly funny episode during the presentation was when Graeme's attachable microphone went dead. As a temporary replacement he was given a handheld microphone, but since this was a real-time coding session, he needed both his hands ... Dierk König jumped in to stand behind him and hold the micro ... this shed a whole new light on pair programming ;-)


The second session was about the Grails plugin system. This session was equally astonishing as the first one. In another live coding session Graeme developed a plugin and demonstrated that Grails plugin development is not only something for infrastructure gurus but a useful way to modularize a Grails application.
On the same time he used the iwebkit plugin to demonstrate how easy it is to develop an iPhone interface for the twitter-clone from his previous session. This was extremely impressive and provoked the urge to try it out yourself...

The next session was by Jim Shingler about Griffon. This session had a hard stand after Graeme's incredible performance. Also the Griffon project seems still very much in the beginning, so there were a lot of questions and several discussions in the audience.
Unfortunately Jim ran out of time, and could not really finish his main goal: A rich client for the twitter-clone built in Graeme's previous session.

The last session of the conference was by Paul King about "Industrial strength Groovy". This was a very valuable talk, since it was obvious that Paul had a lot of experience from real-world Groovy projects. He talked a lot about best practices for Groovy and the similarities and differences between Groovy and plain Java projects. His slides can be found on slideshare.


Day two was wrapped up with a panel discussion with all the speakers of the conference.

One common undertone in the discussion was, that Grovvy and Grails are currently transcending from the early adoption phase into becoming a mainstream technology. This was underlined by the acquision of G2One by SpringSource and by the statement of Dierk König, that Groovy expertise has lately become a selling argument for Canoo.

Wednesday, May 13, 2009

JPA2 - the potential to revolutionize Java development?

innovation.jpg The proposed final draft of JPA2 (JSR 317) is out for more than a month now.

Between the public review version and the proposed final draft, a significant detail was added. This detail might well be overlooked, but in my opinion it has the potential to revolutionize Java development.

I am talking about the JPA Metamodel API.

With the new Metamodel API, queries can become almost completely typesafe. This is achieved by exposing a typesafe metamodel of the entity model.

This metamodel is actually nothing fancy, it is represented as simple annotated Java classes (ups... I might just have lost all the heavyweight MDSD guys ;-))

Now, the usage of Java classes with public static fields to get typesafety is hardly something new. I have been on several project that successfully leverage this.

Of course it makes sense to generate those classes. Therefore most of the projects using this concept have developed some homegrown generator infrastructure. This is usually where the problems start... this infrastructure is mostly proprietary, can be clumsy or outdated, needs special instructions and intricate knowhow. It can and therefore will fail, it interrupts the build process and prevents a seamless development experience (Of course thats just my point of view :-))

That's exactly where the revolutionary potential of the proposed implementation of the new JPA Metamodel API kicks in.

According to spec lead Linda Michiel's Blog:
We plan to release an annotation processor to be run in conjunction with javac to generate these classes.

Gavin King (founder of Hibernate and Seam, spec lead of JSR 299) was the originator of the idea for this typesafe Metamodel API. On his blog he presents the idea to realize the code generation process as an APT plugin for javac:
So I've just spent several days researching the capabilities of javac Processors, and it's very clear that you can generate the necessary types as part of the compilation process. So no tool will be required. (This is a very exciting new language feature of Java 6, by the way).

Emmanuel Bernard (founder of Hibernate Search, spec lead of JSR 303) comments on Linda Michiel's Blog:
Note that while the IDE can explicitly generate the metamodel on the fly, it can also delegate to the annotation processor that is triggered by the Java compiler. Even if the IDE has no specific JPA plugin, the metamodel is still generated on the fly. Same for plain old command line compilation.

As readers of my blog might have noticed, I am not the biggest fan of code generation. But the above quotes sparked my interest, especially since they come from two bright minds that seem to have a sane opinion in the religulous debate of code generation.

So I guess it would be an appropriate moment to look into the javax.annotation.processing package of JDK 6.

As others have noted, the typesafe Metamodel API helps Java to catch up to LINQ in .NET.

revolution.jpg But I think it has more potential!
If the generation process is really seamlessly integrated into the compilation process, then this could offer the means to overcome a lot of the deficiencies of the Java language.
Specifically areas where the lack of method and field literals prevents elegant solutions can now be tackled.
By extending the compilation process, its may even be possible to venture into areas where traditionally dynamically typed languages are especially strong ...

Update: There is even more Information on Gavins Blog: Java 6 compiler plugins and typesafe criteria queries and Linda blogs the typesafe query API for JPA 2.0

Saturday, May 9, 2009

History of programming languages

Exceptionally funny:

A Brief, Incomplete, and Mostly Wrong History of Programming Languages

My favorite:
1842 - Ada Lovelace writes the first program. She is hampered in her efforts by the minor inconvenience that she doesn't have any actual computers to run her code. Enterprise architects will later relearn her techniques in order to program in UML.

This post joins the ranks of hilarious episodes of programming humor:
  • Language Wars
  • Web Framework Trolling
  • If programming languages were religions...
  • If programming languages were cars...

  • Friday, May 8, 2009

    JAXB Quicktip: XMLGregorianCalendar

    Assume you have the following type-declaration in your XSD:

    <xs:simpleType name="dateType">
    		<xs:documentation>Date without Timezone with the following format: YYYY-MM-DD</xs:documentation>
    	<xs:restriction base="xs:date">
    		<xs:pattern value="\d{4}-\d{2}-\d{2}"/>

    If you are using XJC to generate Java classes from the above XSD, then references of Type XMLGregorianCalendar are generated.

    Now, if you instantiate a new XMLGregorianCalendar in your Java code like this:

    GregorianCalendar cal = new GregorianCalendar( 1976, Calendar.DECEMBER, 22 );
    XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar( cal );

    … and then let JAXB render the xml, the corresponding XML looks like this:


    … this XML fragment is not valid according to the above schema!
    What we want would look like this:


    An quick workaround is to set the unwanted fields of XMLGregorianCalendar to DatatypeConstants.FIELD_UNDEFINED like this:

    XMLGregorianCalendar gc = DatatypeFactory.newInstance().newXMLGregorianCalendar( c );
    gc.setTime(DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED);

    Of course it would be much cleaner if JAXB would respect the constraints when generating the Java code. I guess this could be achieved by configuring JAXB accordingly … but I did not go so far.


    Wednesday, May 6, 2009

    Dig your own hole ...

    Programming is the opposite of diamond mining.

    -- Charles Simonyi, SET 2009

    In diamond mining you remove a lot of dirt to get to the diamond. In programming you start with a clear intent, then you bury it within a lot of code.
    Related Posts Plugin for WordPress, Blogger...