Sunday, November 05, 2006

My way to JBoss Seam

If you're not interested in Java and its Enterprise Edition you should skip this article for your own sake. ;-)

I have to admit that I'm pretty lazy when it comes down to technology evaluation. On the other hand I know that I have to do it from time to time and I need to push myself further. Because last thing I want is to remain plain Java-coder. Do you wanna be proper valuable developer? You have to move ahead constantly. Sometimes I just learn things someone else is coming up with and sometimes I propagate something toward our team on myself. To learn something new was one of the most important motivation when we went to visit TheServerSide Java Symposium in Barcelona on June 2006. And there happened that moment in my life. ;-)

Name Gavin King was familiar to me - because of Hibernate, of course. On the other hand I managed to forget it again and so my boss had to remind me who is it when we were going through the presentation description. "And what does he have common with some web framework?!" I was surprised when I read about Seam talk. My boss just shrugged. We were at the room waiting how he would be. And then Gavin came at the stage and started to talk about current situation in information systems development - namely about those delivered to user via HTTP/HTML. I couldn't agree more because many things he mentioned bothered (or still bother) me from time to time. However it's not only the content what's important here (although it's most important I guess). You have to see Gavin talking (and walking and gesturing on stage) because that's really not so ordinary experience. My boss couldn't stand it and he also didn't like that Gavin hadn't said anything about Seam during first 20 minutes of his speech - and so he left to check another talk (and so we also split our forces in order to gain more info from the first hand ;-)).

However, Gavin - armed with his Seam - made an impression to me - and the strong one indeed. This speech was also mentioned on TSS News (Advanced State Management with JBoss Seam). During the TSSJS in Barcelona we noticed the obvious - the community is kinda split between Spring (or other lightweighted container solution, whatever the technology stack around is complete ;-)) and the Java EE. Gavin King identifies himself as EJB3 lover. And now I started to understand it. Of course I saw some EJB3 examples with annotations before. At last bean implements the EJB interface really, many XML things are gone and everything looks simpler. I also looked at JSF but there was no use for it in our ongoing projects. And now I saw something that glues these two technologies together and the examples really shows that business code is what really dominates here. At last.

One day later we were kinda lucky when Gavin sat down at our table in foyer where we were relaxing during lunch break. I made bold to address him and then the words were somehow going on. It was exciting talk (at least for us ;-)) and I knew that I have to look at this technology later. And so I did after we came back home. First thing I liked on Seam is the start-up. If you follow the instructions precisely (and it's not so hard) you simply have to finish with Seam examples up and running. I was also surprised that it already has reference documentation - and it is not so brief. Of course you can think about it something similar like critic in this blog post (October 2005) but I found it useful. If you want to change something in examples it's no problem and the change mostly does what you can expect. I miss some "stupid" example where only one bean and JSF is used (useless Hello world ;-)) because it's best minimal example for creating projects from scratch.

I also "enjoyed" Seam more than I wanted during first days because when I tried to create project on my own (not just "refactor" project tree of some example) it was a real pain. It simply didn't work every time. Of course, the problem was between the chair and the keyboard. I rushed to do something and documentation wasn't read completely. Biggest problem in my case (among the others) was to pack seam.properties into EJB jar - even when it's empty. :-) Tricky, huh? Just do it. If you want to avoid similar stupid mistakes just point your browser to Seam's wiki where you can find all important information - along with configuration files glossary. There I read that seam.properties must be in that jar (although I already found it out finally). It was also first time when I tried to use JSF/EJB3 for something real, so no wonder that it wasn't walk-over. However I made it after all and now I just have to create something big with Seam to see if it's so easy in longer run.

You'd may also want to check few others articles about Seam - few (older) TSS news: Gavin seems to really dig JSF and JBoss 'Seam', app framework for JEE 5, released in beta (causing some flame with Springers ;-)). See also this article on OnJava. There is also JSR 299 named Web Beans and it tries to make standard from something like Seam. And yes, Gavin is the spec leader. ;-)

I'm really happy to see all this work (among the other) toward simplification of Java EE development because I have few J2EE 1.4 experiences and it was more pain than gain. Now I'm starting with Java EE again. :-)

No comments: