Daveo
Daveo

Reputation: 19872

Service boundary's and granularity

Are there any general rules on thumb on when to add a method to an existing service or create a new service. For example I need to do persons address look-up via an external third party lets call them XYZ.

Should I

  1. Create a service called XYZ that I use for all out going calls to XYZ
  2. Make a service called EXTERNAL. That can be used to call any third party provider
  3. Make a service called Lookup that could lookup data from XYZ or ABC but only does lookups.
  4. Make an Address service which is used for all address related functions
  5. Add a lookup address method to my existing 'customer' Service

I guess what I am asking do I make the service abstract or not and how generic should it be.

Upvotes: 0

Views: 87

Answers (1)

ekostadinov
ekostadinov

Reputation: 6940

I would say - it depends from your current architecture. If it's a Micro SOA, than a level of granularity IMHO #1 will do just fine:

Create a service called XYZ that I use for all out going calls to XYZ

If you keep the SOLID principles, this will give you your answer on granularity, plus those:

1) Release Reuse Equivalency Principle (REP)

2) Common Closure Principle (CCP)

3) Common Reuse Principle (CRP)

4) Acyclic Dependencies Principle (ADP)

5) Stable Dependencies Principle (SDP)

6) Stable Abstraction Principle (SAP)

Upvotes: 1

Related Questions