Archives de catégorie : jazoon 09

Jazoon 09 : First day, first sessions

The following sessions were given during Jazoon 09, on Tuesday the 23rd of June 2009, vous pouvez lire la traduction en français sur le blog de Valtech

James Gosling keynote : 9:50 to 10:45

First a nice little video from Java One, introducing the history of Java ! Very funny how Java conquered the world !
Then James Gosling begins his speech.
Today there are more JREs installed than people on earth ! It can be be smart cards, desktops, phones… 6M Java developers today in the world … 15M JRE downloads / week.
You can now view Java as « Learn One, Work everywhere » because it’s really spread everywhere now !
James Gosling then describes the brazilian healthcare, where every piece of paper is now on the network : prescriptions, x rays, everything is now on the network (thanks to Java !), ebay, metropolitan networks cards, web apps, games… Java is everywhere !
But the main thing is not java as the language, but the JVM that now hosts Ruby, Scala, JavaScript, etc…
James then showed us a bit of java code : a servlet for Java EE6 running on GlashFish v3, changed, saved and instantly shown just refreshing the browser ! No more deployment bottleneck !
He also introduced Netbeans, as the best IDE ! version 6.7 now integrates with project kenai, a sourceforge like (you can check in/out merge your files, etc… from Netbeans to kenai), also some better maven support.
Java is also used in the real time world, even in a car that James turns into electric : a lincoln (lincvolt.org) which is hybrid, connected to the internet, running java code for measurement and control.
Now down to the performance part : Java is highly optimized, genrally beats C/C++, GC is a lot faster than malloc/free !
Multithreading is the future of software designing : because the processors speed is not evolving anymore, we’ve got to think multicore !
Java is also running on cellphones, JSR 248, Mobile Service Architecture aggregates all Java mobile specs.
JDK7 will be modular (see Mark Reinhold’s blog), dynamic language support will be available too (JSR 292?); waiting for Java 7, there are still Java SE 6 updates : better browser and desktop integration are on their way !
Of course, we got a few slides about JavaFX, which can run on desktops, mobile phones, set top boxes, etc…
To finish his speech, James reminded us with all the java communities : netbeans.org, java.net, glassfish.org, etc…

Java EE 6 11:00 – 11:50 by Roberto Chinnici from Sun

Java EE6 was too complicated, so they decided to make it more easy to use, more powerful, and more flexible.
That’s why they created the profiles, letting the users choose the features they need.
For example the web profile includes everything for the web development, including the EJB 3.1 lite, and bean validation.

Servlet 3.0

New annotations @WebServlet, @WebFilter, @WebListener, the possibility to register new web components just adding them to WEB-INF/lib directory, a new async mode using just a single thread for many requests

JAX-RS 1.1 : RestFul webservices

This API is there to abstract low level HTTP details : using @GET and @POST (etc..) you can define your retrieval and creation REST operations, JAX-RS translates the XML to the java entities (and back) automatically for you (you can also use JSON)

Bean Validation 1.0 (JSR-303)

This API is here to validate fields (text inputs for example)
Seems to be really verbose just to define constraints… We’ll see…

EJB 3.1

No intefaces anymore ! One source file per bean.
New timer annotation @Schedule allowing some cron-like scheduling in the container : a great example provided is the case of a cache refreshing ! No more Mbeans called externally with crons, everything can be integrated in the application code !
EJB 3.1 lite can run on Java SE, great for testing and also in a war file !
Oups, we’re running out of time, the speaker skipped JPA 2.0

« Design Patterns » in Dynamic Languages 12:00 – 12:50 by Neal Ford from ThoughtWorks (nealford.com)

After comparing mixing dynamic languages with whisky blending, Neal Ford reminded us about the history of Design Patterns : basically for « making C++ code suck less » !
But the point is : the design pattern designed in 1994 are not always useful today : for example the iterator is quite complicated, whereas today in dynamic languages, like Ruby a collection.each{[x| puts x} is so much more… efficient !
Command design pattern is already built in closures !
The same for strategy, template, interpreter (the example showed how easy it is to implement a DSL in Groovy, defining new behaviors in the Integer class), decorator, recorder, adapter
Then Neal described some other desgn pattern for dynamic languages : the null pattern (?. in groovy) and the aridifier pattern.
To conclude with, Neal suggest that we should try the tools provided with the languages we’re using instead of blindly trying to copy the patterns designed for older, other languages !

Gradle : A build system for Java 14:00 – 14:50, by Hans Dockter

First the speaker reminds us of Ant and Maven.
With Ant, it’s always been repetitive, with a lot of copy and paste when a new project starts, due to Ant limited domain model (resources, target, properties,)
There is no place for listener in an Ant build…
A gradle script can import old ant build scripts.
With Gradle, you can call ant tasks, and even implement listeners on your ant task… An ant task called in a gradle scrip can even be aware of the next task that will be called !
Maven, on its side is a build by convention framework, which has introduced dependency management.
But Maven uses XML, and 25 lines of XML are required to launch a simple build !
Maven uses transitive dependency whereas Gradle is able to skip tasks (which can be handy when a Maven dependency is broken…)
Gradle aims to be a build language rather than a build framework; because when a framework does not implement a functionality, you spend your time fighting against the framework to make him do something it was not intended to do.
You can define your maven build with a groovy script using gradle.
With gradle, it becomes easy to define usually manual and entreprise specific tasks like release management or deployment.
Grandle can use Apache Ivy or Maven dependencies, it can even deploy a build to a maven repository.
There is also a Gradle Wrapper to start using Gradle without installing it : the Continuous integration machine will download Gradle for you and execute the gradle script (which is a shell script downloading gradle) !
What’s next? Gradle 1.0 will be out in Autumn.
Q&A :
What open source projects are already using Gradle ?
Grails, but others are to come.

Next Generation Enterprise Builds: Maven, Mercury, and Tycho (for OSGi builds) by Jason van Zyl from Sonatype

Maven 3.0

Better integration in IDEs, faster, rewritten artifact resolution system, etc…
Maven 3.0 is more focused on integration tests, provides a new version of the plugin manager, a queryable lifecycle to make the tools able to predict what’s going to be done and also able to ask to execute a particular step.
Maven 3.0 uses Mercury : a new repository and transport layer, that can be used with others systems (Ruby gems, Eclipse P2 dependency management)

M2eclipse

M2eclipse has also been improved, now m2eclipse won’t call every maven tasks on a a save action, it will only call the appropriate ones.
The m2eclipse team would like the users to be able to resolve every maven operations from Eclipse,
M2eclipse is now compatible with Flex (out by october 2009).

Nexus

Only 5% of the maven users use a repository manager.
Nexus is also for binary sharing inside the enterprise, it a repository manager, it’s like a source control management, but for binaries !
Nexus main advantage is also the caching system it provides.
Nexus can be queryed through m2eclipse, Nexus API can be used through REST, which makes it very easy to use.

Hudson

For its next version, hudson will integrate :d rools workflow integration (with a workflow editor), a rest layer to query hudson, unifying hudson m2eclipse, nexus better maven integration

Testing Zen 16:00 – 16:20 by Thomas Mueller, Day

In this session Thomas gave us the reasons why we should test our code.
Then he continued giving us an example of fuzz testing (data generation to test)
Code coverage (with Emma) to find untested and dead code.
Database testing is often hard : a pain to install… so you can use a Java SQL Database like HSQL (a good one), H2 (the best, and also the one the speaker is working on ! ;-) ) or Derby (the worse).

Creating Performance Test Data with benerator, by Volker Bergmann

Usually performance testers prefer testing with production data, but sometimes it is not possible (for privacy reasons or if the system is new).
In those cases, you have to use a data generator, like Benerator that can create and anonymize data, to DB, file, LDAP, JCR, etc…

To finish the day, we had a really nice speech from Neal Ford, about technology predictability, that was real fun !