Dierk König

author
+ Follow
since Nov 01, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dierk König

Congratulations everybody!

It has been a pleasure being in the saloon.

Thanks for all your questions and interest.
Thanks to the bartenders for organizing this event.

keep groovin'
Dierk
11 years ago
Hiall,

in this forum, we have heard some questions about Java/Groovy interaction as well as questions about GUI building.
Sun has recently released an interesting demo about this. Check out the screencast at http://blogs.sun.com/geertjan/entry/video_groovy_makes_java_better .

Since "seeing is believing" I hope that this clarifies my point about "there is no difference" (other than Groovy is much simpler).

cheers
Dierk
11 years ago
What do you mean by


call a java program


?
Instantiating a Java class? Calling a method? Calling a main method?

How would you do the exactly same from Java code?

cheers
Dierk
11 years ago
Hi Ajay,

please make sure you have followed the installation guide under http://groovy.codehaus.org/Eclipse+Plugin .

As a sanity check run this Groovy code:



If your problem remains, please post your Groovy and the stacktrace.

cheers
Dierk
11 years ago
Hi Vikas,
you do exactly the same as you would do in Java, e.g.



or did I misunderstand your question?

cheers
Dierk
11 years ago
Thanks for your kind words Freddy,

well, strategies are different, depending on the context.

With management being totally non-technical, they are not likely to understand any of the technical points you may bring forward. This leaves us with promising time or money gains, which I personally dislike - even if they are true. Therefore, in this scenario, I follow Scott Davis in telling them that we do is all-Java (which is true) with some elaborate config files (the Groovy files).

With technical management I would show them some Groovy code. Some that's very close to Java and some that reduces the verbosity of Java dramatically.

When there is fear about introducing Groovy in your project, then you can start using it outside the production code: replace build automation scripts with Groovy, use it for unit- and functional-testing, for prototyping, and so on.

cheers
Dierk
11 years ago

Originally posted by Marc Peabody:
I want to say thanks for such a great book, Dierk. GinA got me started on Groovy and made the experience fun.



Thanks a lot. That's much appreciated!
Dierk
11 years ago
Groovy is only different from Java when it comes to package names in that it has not only "java.lang" as default import but also
java.io
java.net
java.math.BigDecimal
java.math.BigInteger
groovy.lang
groovy.util

If you misspell any of those, it may appear as if Groovy would be more forgiving...

cheers
Dierk
11 years ago

Originally posted by Prad Dip:
Groovy experts and authors suggest to have many classes one in a script file for performance reason. This is because groovy parses the entire script file before the code gets executed and classes in the script file are more easily availble than when put in another script file. So we do we organize code - Doesn't script file bloat ?



I'm not sure what you mean by "suggest". It is certainly not a general "best practice" and particularly not adviced because of performance considerations.

Could you please link to what expert or author you refer to?

cheers
Dierk
11 years ago

Originally posted by Peter Johnson:
How much was Groovy influenced by Ruby?
Groovy was influenced by a number of languages. I see that following order (most influence first) :
* Java, because that is what we rely on and integrate with
* Python
* Ruby
* Perl (especially when it comes to what we try to avoid)
* Lisp
* all the other languages that the devs have ever worked with

Are there problems that are more easily solved in Groovy than Ruby...
Everything that requires tight Java integration, like using Java frameworks that rely on annotations or generics, writing an EJB, extending abstract classes that may have overloaded methods, cross-language refactorings, and so on...

...or the other way around?
When outside the Java platform, Ruby can start up faster which makes it better suited for writing quick-starting scripts like textmate bundles. With Groovy, you typically have a startup-delay of one second or so because of the JVM.

Other than the fact the the JVM provides a much better runtime, what are the advantages of using Groovy over using Ruby?
* leveraging existing Java knowledge (if any)
* using existing Java frameworks and components
* seamless mix&match of Java and Groovy implementations
I guess you see the pattern ;-)
If Java is of any value for you, then is Groovy. If you work in a total non-Java shop, then Groovy provides no benefit for you and you may take Ruby, C#, or whatever else.

11 years ago
JUnit is included in Groovy.

Lets say you have a file MyTest.groovy with content



Then you can simply run that test from the commandline:

or alternatively compile that class with groovyc or your IDE support and call the test exactly the same way as if it was written in Java (in IntelliJ IDEA, I simply right-click and select "Run Test" to start the internal JUnit support).

cheers
Dierk
11 years ago
With Groovy, you can write Swing apps very easily.
For that, you don't have to install any additional module.
Everything is included.

cheers
Dierk
11 years ago

Originally posted by Curt King:
I am a bit underwhelmed

Cool wording ;-) Hits the nail on the head.

I'm afraid there is no better solution for eclipse that I know of - but I'm only a very sporadic eclipse user.
What about trying a new IDE on a long afternoon?

cheers
Dierk

11 years ago
Groovy is licensed under Apache 2, which means differently from Java that has it's own license.

Groovy 1.5.x runs wherever there is Java 1.5+.

cheers
Dierk
11 years ago
If you do web development, check out http://grails.org.
It makes developing a Java Enterprise app bases on Spring and Hibernate a real pleasure to work with.

cheers
Dierk
11 years ago