I have a service that needs information implemented by another service in the same layer. Is it good practice for one service to take a dependency on another service in the same layer?

  • 2
    I would think that the best practice is to extract the part that's used in both web services, and have both services use that.
    – user16764
    Mar 2, 2014 at 19:14

3 Answers 3


Yes. I have seen architectural diagrams of SOA (Service Oriented Architecture) where exactly this happens. A service should be written in such a way that it doesn't care if user is calling it, a service in the 'same layer', or it is being combined into a composite service.

The Open Group SOA Reference Architecture diagram shows services calling services in the 'same layer': Figure 22-2 (http://pubs.opengroup.org/architecture/togaf91-doc/arch/chap22.html)

The Open Service Integration Maturity Model (OSIMM) has a good diagram if you search for it. There used to be a good write up from Kim Clark and Brian Petrini but IBM have annoyingly taken down the 'old' content (original link, wayback machine as it was but no images, low res version but most likely to stay up, University of Vienna)


I use my services within each other. This way I am able to reuse my service methods, instead of copying algorithms all over the layer.

In my experience, one thing to be aware of is circular dependency.

  1. When initializing a service class, say in the constructor, initializing other service object fields may lead to never ending circular calling if the field also depends on the initializing service.

  2. When calling a method, a service method may call another service call and that may also call another service method which can lead to circular call again.


you could use "chain of responsibility" design pattern to achieve this.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.