[jboss-user] [JBoss Seam] - Re: Using Seam and Groovy together question

kontro_timo do-not-reply at jboss.com
Tue Oct 23 15:07:52 EDT 2007


I have been writing Seam app using only groovy.
It works nicely (although I had to upgrade to groovy-1.1-beta-3).

Biggest issue is JPA entities there groovy works like miracle. Since groovy generates getters and setters for variable without scope.

So jpa entity written in groovy looks like this:

  | @Entity
  | class MyEntity implements Serializable {
  | @Id
  | Integer id
  | String value_field
  | }
  | 

With session beans groovy does not help that much since there has to be getters and setters defined in inteface. But if one uses seam managed pojos productivity would increase a lot.

Since I do not use IDE (coding using vim) more shallow directory tree for source files is nice too. Groovy does enforce rule that source file of com.mydomain.project.feature.thing has to be in folder com/mydomain/project/feature/. So since in one project every package has same domain (like: com.mydomain.project) I put source file in folders like src/feature.

Groovy also allows multiple classes in one  source file. So I have source file like MyClass.groovy and it contains both MyClassBean and MyClass local interface. Easy to add method for both since those are in same file.

Writing unit tests using groovy is great fun since creating lists and maps for mocks is so much easier.

So far I can not see how groovy would make project more difficult to manage. Just replace javac with groovyc in build.xml and have fun.

Please do not ask about performance compared to plain java - I do not care since most of the processor time goes for handling tcp/ip stack, ssl and database queries anyway.

Biggest problem with groovy is that it adds many pages to the paper stack that defines project dependencies. Adding groovy specs top of all those jsr, facelets, richfaces, seam reference specs/howtos/tutorials does not make 9 to 5 coder happy.

-kontro-

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4098023#4098023

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4098023



More information about the jboss-user mailing list