9 Replies Latest reply on Jan 2, 2008 10:25 PM by fangzx

    Using Seam and Groovy together question

    samdoyle

      So I have just started to look at Groovy to see what the hype is about. It is interesting to see what appears to be pretty much a dynamically typed version of Java. Why this is happening alone has me wondering.

      I have worked with some large scale projects awhile ago that were done in Perl and TCL. I have not had the the pleasure to work with Python, PHP, Ruby etc. but from what I have noticed is that when these projects grow considerably and more and more people start delving into the code it can become a bit nightmarish to maintain.

      That being said now let me come back to using Seam with Groovy. What does this really buy me? I understand you can make hot deployments by copying the files into a directory without compilation and the next load will make your changes visible. So beyond that is there anything I'm missing?
      I mean the deployment through using NB for me is pretty quick and I get amazing insight and support from the IDE which I don't have with scripting languages.

      Looking at some blogs people seem to be raving over things such as closures and automatic implied getter/setter operations along with some other syntax related suger.

      So once again back to Seam. I mean if I use Groovy aren't I still making use of Facelets and JSF components such as RichFaces or is this gone and replaced by GSP and Groovlets as I think they are calling them.

      Although new technology can be exciting in terms of learning something new I really dislike it when now I have to really delve into things to see if this actually gives me something that I really need and will make my company and myself more productive. I mean if this is the case then I'm all for it. If not then am I not wasting my time with the exception that for myself personally I have learned yet another new technology framework?

        • 1. Re: Using Seam and Groovy together question
          samdoyle

          I know this is a bit winded but would like to hear from someone who has gone through the Seam + Groovy experience if there are any out there.

          S.D.

          • 2. Re: Using Seam and Groovy together question
            samdoyle

            Nobody has tried Groovy and Seam together? Do I need to be the first and take a leap even though I don't really see the reason for doing so? =/

            S.D.

            • 3. Re: Using Seam and Groovy together question

              The main advantage is simply being able to write in Groovy. If you can write a component more quickly using less code that is more understandable, that's a win. Groovy development doesn't require a compile step, which might make your development faster. Basically, if you prefer Groovy, for whatever reason, Seam is there for you. I think being able to write a facelets template that talks directly to a groovy component is pretty neat thing, but if you don't already have a need/desire to use Groovy, stick with Java. There's no obligation to make use of it.

              We don't provide any direct integration with other Groovy technologies like GSP, but we'd welcome any Groovy users out there to try it out and report back. We're rather eager to make Seam more groovy.

              • 4. Re: Using Seam and Groovy together question
                samdoyle

                Hi Norman and thanks for for the response.

                I think we are just going to have to take it for a test drive and see for ourselves. I mean I'm pretty happy with Java but if this is something that can help in being more productive in the long run then it is certainly worth the time evaluating.

                S.D.

                • 5. Re: Using Seam and Groovy together question
                  kontro_timo

                  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-

                  • 6. Re: Using Seam and Groovy together question
                    epbernard

                    Today the main reason to use Groovy in Seam is the language features: closure, duck typing, list, map, properties etc etc. So essentially, code conciseness.
                    The hot deployment can actually be done with regular classes (provided that you compile them).

                    In the near future, we plan to do some things related to GString and Seam injection. Depending on how people are interested, something like GORM for DAOs might be on the target too.

                    • 7. Re: Using Seam and Groovy together question
                      fangzx

                      About hot deployment:
                      When I use java to write service component, and modify the java source code, hot deployment take effect. But when I use groovy to write service component,the hot deployment effect disappear.

                      Can anyone help me?

                      • 8. Re: Using Seam and Groovy together question
                        fangzx

                        The above hot deployment occurs only in Glassfish v2ur1, in Tomcat 6.0.14, it is ok?

                        • 9. Re: Using Seam and Groovy together question
                          fangzx

                          The above hot deployment problem occurs only in Glassfish v2ur1, in Tomcat 6.0.14, it is ok!