lundi 2 février 2015

Patterns of Service objects inside the Service layer


Many architecture patterns mention some type of service layer like in DDD, onion architecture, hexagonal, etc...


Recently I noticed that my service layer tends to grow to type of service objects




  1. Singleton service objects with no constructor.


    Mailer.send(message)




  2. Temporal services with constructors.


    PersonService.new(user_session).find_all




Is there any naming or pattern that makes a difference while describing these two types of service objects?


I am noticing some patterns in their use, like the second case being more common when an external service talks to the inner model. However I am curious if some of the architectures mention this in more detail or if there is different naming / related patterns that tend to coexist inside the objects of the service layer.





Aucun commentaire:

Enregistrer un commentaire