“Before you speak, listen. Before you write, think. Before you spend, earn. Before you invest, investigate. Before you criticize, wait. Before you pray, forgive. Before you quit, try. Before you retire, save. Before you die, give.”

Wednesday, January 5, 2011

Seam Framework or the JEE answer to Ruby on Rails

After playing with Ruby on Rails for almost a month (and coding my weight management application) I can honestly say I have found my love for coding again. Mostly because of the instant feedback effect.
As I kept reading various resources on RoR I found one issue with it. It does not support XA transactions. That is if you are using an application that has to synchronize 2 databases in a transaction RoR can't help you.
Of course RoR is just a framework and Ruby standards are not as good as Java ones so there is no JTA (Java Transaction Api) equivalent in Ruby/RoR hence you are on your own. So writing enterprise stuff in Ruby will just have to wait for a while.
That did not stop me from spending the New Year's eve and 2 days after just coding a RoR application between drinking ,eating and celebrating
Now recently I have decided to study Seam Framework as the JEE answer to Java. I have received Dan Allen's "Seam in Action" book and I am trying to make sense of it.
Seam's fantastic points
1)Conversations
2)Bijection
3)Handling JSF actions on initial Request (or get)
4) Using a conversation scoped persistence manager should prevent all the LazyInitializationExceptions I kept seeing in the past 2000 days of JEE programming (not that many but you understand ..)
5)Integration with Drools , jBPM-of course best to be used in a JEE container.
A lot more small stuff that makes your life easy.
Unfortunately I can't help thinking that 2 heavy weight containers (JSF and EJB3) are integrated in a bigger container. The problem is whether Seam provides a good abstraction or a leaky one.

Of couse while reading Dan Allen's book I found that at least in the 2 initial chapters he kept trying to offset Rails .. unfortunately hot deploy is not complete in JBoss/Seam .
There are several severe limitations
  • you need to be using a war project (no EJB's)
  • you need to have a tag specifying debug =true
  • you need to configure the ide to do the explode on edit thing(or type seam explode)
Even then you would not be allowed to do Entity classes changes and changes to Session Beans without redeploying.
So it is true that it helps but even Dan specified in a Seam Framework post that incremental hot deploy in Seam is a bit of a hack .
What I did enjoy was doing integration testing with Seam , TestNG and Embedded JBoss these shoud alleviate the pain of repeated build/deploy/test cycles I mentioned. Nevertheless integration tests are always slower than basic unit tests.
I can run 54 pure unit tests on my machine in 2 seconds but just 4 integration tests take 16 seconds.
For the record my machine is now upgraded : Core i7 860 , 8GB RAM (Corsair) ,1TB HDD so I guess we are talking top of the line performance.

As a side notes I found that doing RoR development using JRuby and Webrick makes testing in the browser faster then integration testing in controllers (yap JVM start times to the rescue) so doing TDD with JRuby is not easy either.Nevertheless they take 2.8 seconds to execute + 10 seconds JVM startup time (that's why Java will never be used for OS development :) ).


Anyway if you need to stick to the JEE world or need distributed transactions go for Seam , if you are confident you won't need distributed transactions you cand certainly go for Ruby/RoR.

My objectives for the year ? Just get to 100 kg and stay there.
What I need to have this :
  1. Diet and calorie counting
  2. fitness performed regularly.
I even wrote my own RoR code to track this (not yet business ready but functional)
Oh btw : Happy new Year.