Quantcast

Service classes for non transactional logic

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Service classes for non transactional logic

clr meno
Is it recommended to add business logic or utility methods, that don't interact with domain classes, in Service classes? Or is preferable to add it in the Src/groovy?

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/f583ac0b-2114-4310-be58-9d8adbe32b63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Service classes for non transactional logic

Jeff Brown-3
On 1 Apr 2017, at 20:16, clr meno wrote:

> Is it recommended to add business logic or utility methods, that don't
> interact with domain classes, in Service classes? Or is preferable to
> add
> it in the Src/groovy?
>

Sure, there are plenty of things that you might put in a Service that
don’t have anything to do with a database.



JSB

--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/11CFED6A-5DAC-4161-8F60-3A32CB6A6B40%40objectcomputing.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Service classes for non transactional logic

clr meno
Thanks Jeff. If thats the case then how to decide if a non transactional class needs to go in Src or Service ?

On Saturday, April 1, 2017 at 3:49:23 PM UTC-4, Jeff Scott Brown wrote:
On 1 Apr 2017, at 20:16, clr meno wrote:

> Is it recommended to add business logic or utility methods, that don't
> interact with domain classes, in Service classes? Or is preferable to
> add
> it in the Src/groovy?
>

Sure, there are plenty of things that you might put in a Service that
don’t have anything to do with a database.



JSB

--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
<a href="http://www.autismspeaks.org/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.autismspeaks.org%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHLOilSQBYB1lzLN6Ms6K6DtQY5DQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.autismspeaks.org%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHLOilSQBYB1lzLN6Ms6K6DtQY5DQ&#39;;return true;">http://www.autismspeaks.org/

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/b1ba0ce2-0a97-4f8f-ba1d-c14eae39a540%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Service classes for non transactional logic

Jeff Brown-3
On 1 Apr 2017, at 15:25, clr meno wrote:

> Thanks Jeff. If thats the case then how to decide if a non
> transactional
> class needs to go in Src or Service ?
>

Understanding what the class is for and how Services behave will help
you decide.  For example, if you don’t want an instance of the class
automatically added to the Spring application context as a bean, don’t
make it a service.  Another example, if you are writing a class to
define Groovy Extension Methods, it would be silly to make that class a
Service.

In short, make it a Service if there is a reason to and if there
isn’t, don’t.



JSB

--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/A85D06CE-8895-47D2-B453-2B14F4636D85%40objectcomputing.com.
For more options, visit https://groups.google.com/d/optout.
Loading...