• Home
  • About
  • JavaOne 2011 Tuesday

    October 5th, 2011
    The Java strategy keynote started slowly with Juniper networks presenting their
    take on Java, which was in my eyes not really related to the topic of the keynote.
    It then went on into the Java roadmap with the announcement that new Java versions
    should come every two years, which sounded to me like an excuse for Java 8 being
    deferred until “Summer 2013″.
    The real surprise was a demonstration of JavaFX running various devices like
    tablets and smartphones running Windows, Android, and even iOS! It appeard to
    be experimental but the sheer possibility makes a difference.
    In addition, JavaFX will be fully open-source such that everybody is free to
    port it to his platform of choice.
    Over lunch, the “Java Desktop Community” assembled in a nearby restaurant.
    That was an awesome opportunity for meeting the Swing and JavaFX luminaries just like in the years before.
    In the early afternoon, I headed for the talk about custom JavaFX components
    presented by Jonathan Giles and Jasper Potts. It appears customizing any
    control is mainly done via CSS. In other words, there is no typesafe API.
    I would rather prefer to use CSS only for “skinning” and keeping an API for
    source-code integration.
    It also came out that the current JavaFX version doesn’t contain e.g. a
    ComboBox. This came as a surprise since I would expect this as being part
    of the standard widget set. I curious what else is missing.
    There also is a distinction between public and private APIs that didn’t
    make immediate sense to me – other than the private parts are not yet
    finished.
    The afternoon JavaPosse BOF was rather disappointing. They re-told the
    story of this morning’s keynote. Who needs that?
    Visiting the pavillion was nice even though it was just as small as
    last year. Anyway, I ran into a number of friends and dropped by the
    gradleware booth. They liked my animated Gradle logo, that I implemented
    with the Groovy-based FXG interpreter.
    The SpringSource friends were just shutting down the booth and invited
    me to dinner: http://t.co/LfxhjIH8 . Thanks a lot!

    Finally, late in the evening I joined Dan Sline’s talk on WebServices in the Groovy space. The major take-away for me was a repercussion of the well-known advice: “keep it simple”.

    Throughout the day, a lot of people approached me to tell how much they liked my talks yesterday. That was a really nice experience. Last year I had the very last talk of the conference and only this year I recognized how much of a difference the scheduling of the talks make.

    Dierk Koenig


    JavaOne 2011 Arrival

    October 2nd, 2011

    This is gonna be a short series about my impressions of JavaOne 2011.

    As always, it is nice to see the town decorated for the event, even though Oracle World gets certainly much higher attention. So the immigration officer as well as the nice guy sitting next to me on a bench at Union Square ask “ah – you are a programmer? Are you here for Oracle World?” “Hmpf…”

    Should you ask yourself “what’s in for me”? Here is a first answer: the conference material

    The bag is not very practical for a software developer. I guess the selection has been taken by an Oracle employee who assumes that their conference attendees never carry any material themselves in the first place (which may be true for OracleWorld). The jacket is very nice, though.

    And, yes, you can rate conference organizers by the badges they produce. Hey, that should not be too difficult, right? Here is what you still can make wrong:

    • Printing the delegate’s name so small that it is hardly readable from more than 20 cm away. Now since the badge usually hangs at belly height (if not lower) this can be a bit embarrassing for both involved parties.
    • Second, the name belongs on both sides of the badge! Really! How often did you try to read the name only finding that the badge hangs the wrong way around?

    Otherwise, the waiting time was not too long. The speakers registration was actually empty when I arrived. The attendees registration was pretty well filled, though. But then everybody has to go to the material pickup which was for me in Moscone West 3rd floor where I waited in line for about 20 minutes and I was very early and the queue grew much longer afterwards.

    This made me think about my latest work on highly concurrent producer-consumer scenarios (http://people.canoo.com/mittie/kanbanflow.html) and what it would need to improve the situation.

    Otherwise, from studying the program schedule, I found that Oracle has wisely chosen to pretty much always put two Groovy-related talks in parallel as if to make sure that nobody can escape the Groovy (\G) in these time-slots.

    I’m eager to see what the week will bring.

    Dierk Koenig, @mittie


    Testdata generation

    September 26th, 2011

    We’ve all being there, we’ve all had this on a project once or maybe even more times. The assignment is to build an application, but there is no data for you to work with. There could be any number of reasons this could be the case to name a few, the web-service that should be connected is not done in time, the database migration is postponed. Then someone has to create database scripts with test data, or implement a test web-services. This is all a waste of time.

    But lucky for you now there is a solution.

    I’ve created an little test data framework that is easy to setup and will create test data automatically. So how does it work? Simple, its entry point is a method interceptor that you can wrap around anything you want, it doesn’t even have to be an implementation. So that DAO you want to use, but the database is still empty, just let the framework step into place and all the methods return the data that you want.

    It can also be handy to create test data for you unit test. You need to test if you bean serialization works, or want to put an entity into a in memory database with dbunit. Just call the framework with you bean class and the framework will return an instance filled with test data. It will read the existing annotations that you have on your entity bean an will only generate data that is valid for you bean.

    Here is an example of how it works:

    
     //Create an instance of the Employee class and fill it with test data.
     Employee employee = TestData.createBeanInstance(Employee.class);
    
     //Annotations that restrict the data for first name are recognized.
     assertNotNull(employee.getFirstName());
    

    To create a service that returns test data on it’s service methods:

    
     //create a instance of the service class/interface that will return test data
     Service exampleService = TestData.createService(Service.class);
    
     //this now returns a list of employee instances that are filled with test data
     List<Employee> employees = exampleService.findByName("name");
    

    Create a dbunit xml file:

    
     //create a file
     File fileLocation = File.createTempFile("file", ".xml");
    
     //populate the file with test data for the employee
     TestData.createDBUnitDataSet(Employee.class, fileLocation);
    

    If employee has relations with other classes, like employees have managers these objects will also be in the generated xml file.

    To give it a spin add the following into you pom.xml

    
         <dependency>
             <groupId>ch.nerdin</groupId>
             <artifactId>testdata-framework</artifactId>
             <version>0.10</version>
         </dependency>
    

    or if you use ivy, gradle or something else you properly know how to use this information as well.

    So nothing holding you back to make your data driven test easier to setup, or to stub out you migration points. I’m hosting this code on github so if you have issues, comments or even better contribute please do so.


    GWT and HTML5 Canvas, the future of the web?

    August 25th, 2011

    The future of computing lies in mobile computing, more and more devices come on the market, tablets and phones that will connect through the Internet as technology is getting cheaper and wifi and 3g more common. That means our software will also need to run on these handheld devices, because our clients will want their services on all platforms. This is what Java set out to do 15 years ago, so that we have the ability to write software once and run it everywhere. The problem is these new platforms, that I believe will make up a large part of the future have, until now, no Java. It would be great if we can find something that will give us the ability to write our software only once.

    I believe that the technology that is going to deliver us this promise is called HTML5. More and more applications will run inside you browser. I’m typing this article in google docs, which is a perfect example of how applications will evolve. No need to install anything or maintain up to date versions, even an operating system could be very minimalistic (google chrome). So Google is obviously sharing this vision, but also Microsoft is building it’s next version of office on something that is based on their web-browser.

    Sadly the development language of HTML5 Javascript and not Java. Java has been around a long time and there are a lot of libraries that people have made. Would be cool if we can still use these, the answer is Googles Web Toolkit. GWT provides a way to code in Java and then translate that code into Javascript. This way we can still use all that great stuff that others made.

    A good example of this future is Angry Birds, you have probably heard of this game. To create this game they have taken the java implementation of box2d called jbox2d and created a javascript version of that with the help of GWT. Once that is done you can use HTML5 Canvas to draw the Birds and calculate their positions if they are falling. Now because they have build it this way with HTML5 this game could also work on an iPhone, but even better because android is based on java you could create from this source a android version with only one line of code.

    Have a look at some of the great things people are building with the HTML5, be sure that your browser supports it.

    1. Drawing program deviantART
    2. Old style game with new technology area5
    3. Quake GWT HTML5 port

    Java 7 Small Language Changes Screencast

    July 14th, 2011

    This screencast demonstrates the small language changes that are part of Open JDK 7, which is available from the Open JDK website. It demonstrates multi-catch, try with resources, strings in switch statements, underscores in literals, and the diamond operator.

    If you have any issues watching the video below, then you may have better luck viewing it on the JetBrains.tv site.

    I’ve made a lot of screencasts and blog posts over the years. If you like this, then there are many ways to see the other stuff I’ve done: 

    The screencast was created with Ubuntu 10.04, PiTiVi, Audicity, gtk-RecordMyDesktop, IntelliJ IDEA, and LibreOffice. OS from top to bottom.

    Thanks for watching, and leave a comment!