I have no experiance with using a scripting language directly in Java.
If I mix java and groovy, doesn't it produce code that is really hard to detect duplicated code?
Can a code coverage tool like CLOVER, detect the coverage of Groovy code? Makes it sense to use Groovy only for Test Classes and MockObjects and let the production code in plain java?
If a developer is not familiar in Groovy, how easy is it for him to understand the code?
Dierk König
author
Ranch Hand
Joined: Nov 01, 2006
Posts: 43
posted
0
Hi,
How do you detect duplicated code in Java? with PMD/CPD? This works well across Groovy and Java.
You can measure Groovy code coverage on source lines level, eg. with Cobertura. The book describes how.
Groovy makes sense for testing Java, but "only" would be far too limiting! ;-)
> If a developer is not familiar in Groovy, how easy is it for him to understand the code?
> If a developer is not familiar in Groovy, how easy is it for him to understand the code?
I don't know. Do you understand
println 'hi'
?
I don't think understanding println 'hi' is a fair assumption that Groovy is easy for a java developer to understand. Closures, for example, are proving difficult for me to wrap my head around since this isn't something that a typical Java developer might be familiar with.
But I do believe Groovy to be easier to understand as a Java developer than another scripting language all together (Ruby, Python, etc).
new File('test.txt').eachLine { line -> println line }
uses a closure. Is it hard to understand? I don't think so.
Of course, you can write any kind of code, code that is easy to understand and very complicated code in any language.
Groovy tries to build on the knowledge and perspective of a Java programmer. But of course to fully leverage its features you also have to learn. That's what the book is for.
So, theorically I can use Java and Groovy interchangeably ? Can I use Groovy completely to develope EGB ? (Enterprise GroovyBeans, inspired by Gregg's Gwing ) Or even to develope a framework like Hibernate, Tapestry or Spring ?
Tug Wilson
Ranch Hand
Joined: Dec 12, 2006
Posts: 33
posted
0
So, theorically I can use Java and Groovy interchangeably ? Can I use Groovy completely to develope EGB ? (Enterprise GroovyBeans, inspired by Gregg's Gwing ) Or even to develope a framework like Hibernate, Tapestry or Spring ?
Yes - We already have Groovelets (which are Groovy Sevlets) and GSPs (can you guess what they are? )