|
I'm suggesting something much more basic: documenting that a domain class may be given behavior by including closures and functions within the domain class definition (i.e. within MyDomainClass.groovy). Perhaps this has been undocumented because it seems obvious and trivial, but I would argue that it is not necessarily obvious to users new to Grails, plus there are various issues that are not obvious to a user even after modest experience with Grails.
def doSomethingClosureWithReturn = { arg -> int doSomethingElse(String arg) {
def doSomethingAnotherWayWithArg(String arg) {
I understand your points, but all of this seems to relate to Groovy's documentation and not Grails'. Clearly Groovy needs to go down the same road in terms of the quality we have with Grails at the moment, but all of your examples are not really about Grails, but about Groovy.
Ok, I understand. Perhaps I'm thinking more about a user guide than a reference guide. May the reference guide could include a simple statement along the lines of "methods and closures can be added to domain classes just as they can be added to any Groovy class". I don't think this simple fact is abundantly clear to someone new to Grails. (I also think that if there is another version of DGG it would be instructive to insert an example of a domain class with behavior – it's such a common thing.)
|
||||||||||||||||||||||||||||||||||||||||||
http://www.grails.org/doc/RC1/guide/single.html#12.7%20Adding%20Dynamic%20Methods%20at%20Runtime
What is that you feel is missing from this?