| Author |
Groovy and Backend programming
|
Mark Grizzaffi
Greenhorn
Joined: Jul 16, 2007
Posts: 6
|
|
Hi, Venkat. I'm primarily a backend Java programmer(non-web based). I've experimented with Groovy but find my code is approximately the same length as the Java code itself. Can you list some examples of how Groovy can benefit backend applications? Thanks
|
 |
Venkat Subramaniam
Author
Ranch Hand
Joined: Jan 28, 2008
Posts: 79
|
|
Mark, I won't be concern first about the length of code being the same. Groovy in fact allows you to mix Java code, so most Java code is also Groovy code. If you have a need to invoke processes, you will see that the syntax is easier and your code size will become smaller for that. If you are being forced to handle exception you don't care about (like exception for Thread interruption in call to sleep), you will see that you don't use them. Once you start using closures, you will find that it is easier to implement certain logic using closures than using inner classes or interface based approaches. Finally, in backend code, if you want to perform certain tasks on different type of objects you can take advantage of optional typing of Groovy along with metaprogramming capabilities. More the code size reduction, you will start enjoying good dynamic behavior that is easier to implement in Groovy.
|
 |
Raghavan Muthu
Ranch Hand
Joined: Apr 20, 2006
Posts: 3287
|
|
I believe mark was talking about the mere # of lines? In such case as venkat said, it may be equal. But what goes inside each line? Is that what matters? I hope Groovy leverages here
|
Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
|
 |
Dave Klein
author
Ranch Hand
Joined: Aug 29, 2007
Posts: 77
|
|
One way that I use Groovy on the back end is as a replacement for JDBC code. You can see a good example of that in this article by Andy Glover: http://www.ibm.com/developerworks/java/library/j-pg01115.html or check out chapter 10 of Venkat's book!
Originally posted by Mark Grizzaffi: Hi, Venkat. I'm primarily a backend Java programmer(non-web based). I've experimented with Groovy but find my code is approximately the same length as the Java code itself. Can you list some examples of how Groovy can benefit backend applications? Thanks
|
Author of Grails: A Quick-Start Guide
|
 |
Mark Grizzaffi
Greenhorn
Joined: Jul 16, 2007
Posts: 6
|
|
|
Interestingly enough, Dave, I had to parse a csv file and populate a DB2 table at work. Used Groovy and was very impressed. Now if I could only convince my colleagues at work to use Groovy...
|
 |
 |
|
|
subject: Groovy and Backend programming
|
|
|