|
Replies:
3
-
Pages:
1
-
Last Post:
Dec 22, 2009 7:18 PM
by: glen.smith
|
|
|
Posts:
2
From:
england
Registered:
7/25/08
|
|
|
|
Chapter 2 : Feedback : Groovy Newbie
Posted:
Aug 14, 2008 2:35 AM
|
|
Hi Glen/Peter,
This was a well-written, informative and no-nonsense introduction to Groovy. It took me 26 minutes to read. I did it in one sitting and I never got lost so a high five there. Throughout, as a Java and Ruby programmer I was continually making comparisons and the chapter answered the majority of my questions. In fact, after the chapter I wanted to go off and read Groovy in Action and then come back to Grails to get answers to my outstanding questions...:-)
Anyway, I understand that this chapter's purpose is to prep the reader for Grails, but whenever developers read such chapters, well i do anyway, I want to fiddle with stuff, take your examples, try them out, change them, just to get comfortable with the syntax. However, the chapter does not provide details on how to do this.
So my immediate questions are:
1) Should this chapter have a piece at the start that tells the reader how to get hold of a groovy console from which they can play with these examples? 2) When I create a grails app, is there a way to get hold of a groovy command line so that I can play with groovy commands and/or scripts? 3) What version of Groovy is this book targeting(1.5.6?) if so, can we state this clearly at the start of the chapter? 4) There is no mention of how to do error/exception handling within Groovy? Is this something you plan to do the Grails way, so not included in this Chapter? I got to the end of the chapter and realised i didn't have a clue how to handle errors, faults and/or problems in Groovy.
Favourite line: "Which leaves us with a strange notation involving a GString..."
Cheers, Cleve
|
|
Posts:
131
Registered:
7/24/08
|
|
|
|
Re: Chapter 2 : Feedback : Groovy Newbie
Posted:
Aug 14, 2008 8:31 AM
in response to:
cleve
|
|
Hi Cleve,
Thanks for the feedback - much appreciated as always. You are right that a reader should be able to try out the examples and experiment with the syntax. You can do this via both "grails shell" and "grails console", which also allow you to experiment with the classes in your application. So:
1 & 2) Absolutely. The introduction should definitely point out both "grails shell" and "grails console" (the latter starts a Swing GUI that you can write scripts in).
3) We are targetting whatever Grails 1.1 ships with, which should be 1.6. I agree this warrants a mention in the chapter. We will probably mention the version of Grails in a preface too.
4) The reason there is no mention of error handling is because it is identical to Java: try {} catch() {}. However, it is probably worth mentioning that Groovy treats checked exceptions as runtime exceptions, i.e. it doesn't force you to catch them whereas Java does. It keeps the code tidier, but it can catch people out.
Having read your comments, I also think it may be worth introducing the concept of scripts early on, probably with the introduction to the Grails console. I can imagine some readers may not be used to writing code without a class.
Thanks for the ideas.
|
|
Posts:
1
Registered:
12/15/09
|
|
|
|
Re: Chapter 2 : Feedback : Groovy Newbie
Posted:
Dec 15, 2009 12:35 PM
in response to:
peter.ledbrook
|
|
Shouldn't "Grails shell" and "Grails console" be "Groovy..."?
The command names mentioned in the book (shell, console) are also not the same as the ones I have in groovy-1.6.7/bin (groovysh, groovyConsole) - perhaps they changed at some point after printing?
|
|
Posts:
142
From:
Canberra, Australia
Registered:
7/24/08
|
|
|
|
Re: Chapter 2 : Feedback : Groovy Newbie
Posted:
Dec 22, 2009 7:18 PM
in response to:
mtnaseef
|
|
These guys are two different beasts "groovyConsole" is a standalone Groovy console that ships with Groovy (not Grails). Good for testing standalone groovy scriptlets.
The Grails console ("grails console" from the commandline), bootstraps a complete Grails environment then launches a special type of Groovy console to allow you to experiment with grails objects (eg new Quote(......).save() )
|
|
|
Legend
|
|
Gold: 300
+
pts
|
|
Silver: 100
- 299
pts
|
|
Bronze: 25
- 99
pts
|
|
Manning Author
|
|
Manning Staff
|
|