Service method or domain static method in Grails?
Question
This is a design question:
- when do I need to create/use a static method (in a domain class for instance)
- when do I need to create/use a service instead?
What is the difference between them?
Solution
If the method is to do only with the behaviour/details of the domain class then I'd make it a method on the domain (not necessarlily a static one). If it is more related to business logic then I'd put it in a service.
cheers
Lee
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow