wood burning stoves 2.0*
The moose likes Groovy and the fly likes I looooove GroovyConsole Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "I looooove GroovyConsole" Watch "I looooove GroovyConsole" New topic
Author

I looooove GroovyConsole

Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

I'm using GroovyConsole more and more and more these days.

Every time I'm writing new code I'm jumping over to it. I'll write the method or class in the console and test it thoroughly in the console before bringing my code over into the IDE.

Has anyone else started working this way?


A good workman is known by his tools.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Hmmmm. I hadn't tried this before, but I do enjoy working that way sometimes (the Jess rule engine has a read-eval-print loop, and I often use that to explore a new Java API by typing Lisp code!) I'm just giving it a try and you're right, it seems very cool. I'm going to check out if something similar is available plugin-wise for IntelliJ, because I'm pretty picky about keybindings and color and such when I'm coding.


[Jess in Action][AskingGoodQuestions]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

I did a little research on the GroovyConsole inside Intellij thing. First, there really isn't anything in the JetGroovy plugin that lets you run the GroovyConsole. Now, that being said, you can create a .groovy file and put any kind of script code in it and tell IDEA to execute it. How is that different than putting it in GroovyConsole first?


GenRocket - Experts at Building Test Data
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Originally posted by Gregg Bolinger:
I did a little research on the GroovyConsole inside Intellij thing. First, there really isn't anything in the JetGroovy plugin that lets you run the GroovyConsole. Now, that being said, you can create a .groovy file and put any kind of script code in it and tell IDEA to execute it. How is that different than putting it in GroovyConsole first?

Great question and I used to do that. Here's what I don't like about simply doing a script inside IntelliJ:
1) I need to worry that the script stays out of versioning.
2) I need to worry that the script isn't in a source path... otherwise it can break everything.
3) It adds to the clutter of editor tabs.
4) I'd rather not deal with the possibility of an infinite loop in a little experimental script slip-up bring my IDE to a crashing halt.
5) Most Importantly: I think it's easier to isolate what I'm trying to accomplish if I'm doing it in an environment that's separate from the rest of my code. It's easier for me to focus on "I have a list of [1,2,3] but I need a list of ['a','b','c']" when I know I don't have my other classes all around staring at me. Out of sight out of mind, and I think my objects have been more cohesive as a result.

I will agree that GroovyConsole isn't perfect with coloration of text. Sometimes it splits up colors where it shouldn't. But I've found that the shorter my methods and closures are, the less my brain needs code colorized to cope with it.
Matthew Taylor
Rancher

Joined: Jun 13, 2004
Posts: 110
Also keep in mind if you are using Grails that there is a 'grails console', too. It gives you everything the groovy console does, and loads the grails domain model.


Grails Consultant
http://dangertree.net
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I looooove GroovyConsole