Created
November 29, 2012 14:21
-
-
Save boyzoid/4169411 to your computer and use it in GitHub Desktop.
Grails Service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public list(){ | |
Layout.executeQuery('from Layout where user is null') | |
} | |
public list( User user ){ | |
Layout.executeQuery('from Layout where user = :user or user is null', [ user: user ]) | |
} |
Not sure I agree that overloading methods would 'change the core nature of the language'. Make it possible to do so, but not mandatory. Problem solved.
I disagree that dynamic argument styles are more elegant and is more elegant. Method overloading may result in more methods (more lines of code), but each method would, in my opinion, more elegant that the uber-method you would need to handle this with dynamic/optional arguments.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure that I'm against it at all - options are great. Just that for my own use of CF, I find that the dynamic argument style is more elegant and uses less and more readable code - in general. The difference with this and ORM though is that it changes the core nature of the language (ORM does not). There are plenty of good statically typed languages, after all.