alt
November 15th, 2011

by Ivan St. Ivanov

Devoxx 2011 is finally here! I waited it for so long and the fun can now start!

Aspects of Java EE application development

I had troubles to pick up the first talk to visit. It was a triple dilemma: Android, Java EE or Scala. Following the pattern to skip mobile talks I removed the first one from the list. Considering the fact that Paul Bakker is contributor to JBoss Forge, I decided to go to Hall number 8 for his session.

It started in a humorous manner with showing an Oracle looking safe harbor disclaimer. And also an explicit content warning.  But what followed was the dream of any real developer – plenty of code, writing an application from the ground up and a lot of fun. But before that we learned that what we thought of a 3-tier architecture is actually 5-tier: presentation layer, then navigation flow layer, followed by the business logic, then connectivity layer (being object relational mapping or enterprise integration system) and finally the data layer – all from the conventional databases to message queues and pure file systems.

The tools that the presenters (Bert Ertman and Paul Bakker) were using included Glassfish (it really didn’t work with JBoss), MySQL, Maven (nothing more appropriate as the speakers said) and InteliJIDEA. Another very special tool that they showed was my favorite JBoss Forge. It was used to create all the artifacts that the Java EE specification requires as well as the maven stuff around each software project. The application that Paul and Bert created was something like the famous Java Petstore, but it was about ordering clothes for our poor Java Duke.

We basically saw all the aspects of a real live Java EE application: JSF compositions and templates, EJBs, Contexts and dependency injection, JPA entities, JPA criteria builder. Of course with Paul Bakker on the stage we got a short insight into testing with Arquillian. And we also saw how CDI events simplify the notification mechanism between services living in a same VM as opposed to JMS. Yes, we saw JMS as well and even with the help from some Seam extensions it was so hard to code. I wonder why Java EE guys tend to show that? They have CDI events, asynchronous method invocation, who would care for JMS on a non-BOF conference session?

We also saw some REST stuff – create a RESTful web service that calls methods on beans injected by CDI.  Finally the speakers tried to push everything to the cloud – to the OpenShift PAAS solution. But it didn’t work unfortunately. Paul wanted to fix this, but there was not time for that. I got from twitter later today that it was a bug that happens when the application to be deployed doesn’t respond quick enough.

To wrap it up, I will repeat myself that this session was developers’ dream: most of the time was spent in the IDE and in the same time stuff was explained at a pace so that people like me who are not experienced Java EE devs can get it. Describing what they did for the three hours in more details deserves its own series of post (I have the notes though). What I didn’t like was the slide with Spring’s Rod Johnson at the end. Guys, let’s work together and not oppose ourselves? Yes, I know that politics rules these days, but blaming and flaming will not get us any further…

HTML 5 Game Development

This session was the other 3-hour slot that I visited. And I must confess that I expected exactly what the title said (I skipped the abstract for some reason). I presumed something like step by step introduction on how to create games for the browser. Unfortunately I learned more things on that from my colleague Petyo Petev, sitting next to me. He told me what game mechanics is, why HTML games cannot scale on commodity hardware, etc. The speaker James Williams had other agenda, though.

He started with HTML 5 basics. Actually most of the HTML 5 stuff that we saw was more JavaScript code using various open source libraries. This is what a newcomer like me didn’t get. How is the JavaScript stuff unique to HTML 5? You can have this code in HTML 4 as well? Or we have dedicated support for it from certain tags, specific to the latest version of the markup language?

Anyway, we heard about new special tags for presenting media, storing data and chaching. You can now run JavaScript code in a separate thread in asynchronous manner. You have also three different APIs to store data outside of the server side part of your application. Of those James recommended Web Storage as it is backed by W3C and is supported by most of the browsers. As for audio and video: different browsers support different media codecs, which makes browser independent development hard.

Next the presentation went into details that are rather hard for me to get. James spoke about the Canvas 2D API where you can use Logo like instructions to draw basic shapes. You can also have transformations as well as directly embed images inside a canvas. You can reach up to manipulating pixels of an existing image: adjust their RGB settings, alpha transparency etc.

The demos that we saw were not so very compelling. I would expect form a presentation layer guy more appropriate usage of colors and fonts in his applications. Even publicly available apps had some bright colors for background and foreground as well as overlapping text and images. When I have to create something important I tend to copy css from other sites, developed by people who understand design much better than me.

I totally lost the speaker when he started to talk about 3D graphics and WebGL. We saw yet another JavaScript library wrapping all the stuff and I personally didn’t get what it has to do with HTML 5 in particular. I saw what camera, geometry, light and shading means in the context of that library. I must admit that here I totally lost James and stopped following what he was talking about. Well, maybe this has something to do with my level of fatigue, which normally reaches its peak at 15:30. J

JBoss tools

Next up in the agenda I visited two sessions form JBoss guys. First it was a talk on Arquillian by its lead Aslak Knutsen and his “code monkey” Dan Allen. I had watched quite a few such talks, but the declared senior level of the presentation was giving me some confidence that I was going to see some new stuff.

The session started with the usual stuff. The motivation behind Arquiilian: eliminating the build form the development cycle. Then it described a typical Arquillian test setup process: configure special test runner, then create deployment archive with ShrinkWrap API, inject the dependencies via CDI, write unit tests and configure different target containers with Maven profiles.

Fortunately the second part of the talk was quite new to me. Unfortunately the speakers (Aslak Knutsen and Dan Allen) had so little time to show the new stuff, that I didn’t really get some of the details. So, you can easily declare and implement Arquillian extensions which are even easier to register with the library in order to integrate into the testing lifecycle.

Examples of such extensions are different deployment containers (not only Java EE), archive appender and archive processor. I’m looking forward to finding out about these features as they are great idea for implementing the heavy tests for the tool that we develop at work. Besides those Arquillian can help you with injecting values directly into your unit tests (imagine having JUnit tests methods with parameters!), hook into the test lifecycles with methods executed after an application was deployed or before it gets undeployed from the container. I wait with great interest for documentation and some examples of implementing all these extension.

The next half an hour in the same hall number 5 was dedicated to JBoss Forge. This time the leading speaker was Lincoln Baxter III and he got assistance by the same guy from the previous talk – Dan Allen. Initially I planned to skip this session as just a week ago I saw something similar in Sofia. However when I met Lincoln in the doorway of the hall he told me that he is going to show something more. So, I believed him and returned to my seat.

This was not the typical JBoss presentation with picturesque slides and cool demos. It was just the demo part that was there. The only two “slides” were actually Forge shell generated screens. The first part of the demo was really about a quick look into the Forge basics: create a new project, add some Java EE features to it: JPA, JSF, etc. Then some tests with Arquillian, execution of predefined scripts with Forge commands, find and install additional Forge plugins, etc.

The second part was interesting for me as I saw how a Forge plugin can be developed (I’m particularly interested in that). The guys made sure that I and rest of the audience remember the procedure by repeating it for three times for various reasons.

Finally there was time for questions. I then learned that even though Forge heavily relies on Maven for most of the stuff, the build system is abstracted away. So Gradle or even Ant builds can be integrated into the tool. Forge also uses Eclipse JDT parser as convenience API to look inside the abstract syntax tree of a Java class. That is why it is so easy to manipulate generated and user-created classes.

I still have questions, but the speakers are here, so I will take my time to ask them e.g. what is the concept of the facets (so called one stop shop for certain set of features), why the tests of Forge core are still failing ;-), etc.

Git and Gerrit

The last session of the day (I skipped the BOFs) was by my SAP colleague Matthias Sohn. I know him from the various courses he gave us in the Sofia office in the area of Git and Gerrit. What is that?  Well, Git is a distributed version control system developed by Linus Torvalds for the Linux kernel development. There is no central authority or repository, but all the developers have their own copy of the repo together with the history of all the commits (imaging developing in the plain and desperately needing to make a diff). In Git it is quite easy to create local branches and developers are encouraged to do so for every new feature.

The Java industry has already its implementation of the Git protocol, called JGit. There is also the EGit eclipse plugin based on JGit that is used as a Team provider for the Git DVCS.

The original approach of Git is to have separate repositories of all the contributors and those higher in the hierarchy pull from the others the newest changes upon request. This is how Linux kernel works and also sites like Github. This implies code review performed by the pulling side. However, there are some projects, like Android and most of the Eclipse stuff, which are still working with centralized authority and in the same time use Git as VCS.

The Gerrit web based tool is a perfect fit for such kind of project to do code reviews. The process is much simplified and improved in comparison to Bugzilla reviews. You can post comment on each line of the code. In the same time do it in an unthreatening environment: the code is not submitted in production before it is reviewed. The philosophy behind Gerrit is to detect the problems early and no to finger point the person that created the issue.

When using Gerrit, developers don’t push their changes directly into the central Git repository, but rather to staging one. There Gerrit manages a separate branch for each feature. If certain feature is not approved by a committer, its next version will be pushed seamlessly into the same branch. This is done in practice by specifying one and the same change ID in the commit message.

You can have Hudson/Jenkins connected with Gerrit. Once a commit is pushed a dedicated job fetches that change, runs the build and the tests and votes positively or negatively based on the result.

The slides contained much information (I call this SAP way of making presentations). In a sense it can be very useful sometimes – if the topic is totally new to you, then looking at the presentation in the next couple of days will still keep the memories fresh.

That’s it for the first day of Devoxx. I’m looking forward to some diabolical, groovier, type safe and continuous fire side experience tomorrow!