Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I looooove GroovyConsole

 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic