The Service Object pattern supports the notion of a client server architecture. That is, service oriented architecture as done with Amazon.com's development. More specifically, a Service Object is an collection of methods tailored to a specific and limited functional application role. This means, we don't have one service object that tries to do everything, we have very specific service objects which do one or two things.
Rules;
- Must not contain a transfer protocol (JSON, XML, SOAP, HTTP, etc) conversions.
- Must only accept native objects and return native objects.
- Methods may be wrapped in transactional support.
Use Cases;
In my applications, there are usually two main service objects and then a significant amount of more defined and narrow scoped services that typically utilize data transfer objects.
1. Crud Operations - save, delete, load operations of standard PersistentObjects
2. Query Object Operations - querying of PersistentObjects
Groovy Example;
0 comments:
Post a Comment