3

Can DI/IoC be used for a simplified, local SOA?

I have been reading up on SOA (examples: here, here and here) and it seems that at first a lot of the attention was at interoperability and enabeling distribution of tasks by using standard message-formats and transfer-protocols (web-services). Later the crux has been to achieve loose coupling: To find principles for partitioning business-logic, manage dependencies and how and when to share data between parts.

Is this a correct description? How is this related to DI/IoC? For a system with low performance requirements would it be a simplification to use DI as a "message broker", and asynchronous events to do "pub/sub" and only break out a service and go across an ESB or such as required by integrations?

1 Answer 1

2

SOA (particularly the view championed by Udi Dahan) certainly shares its purpose with DI: decoupling systems. However, although the purpose is the same, and some of the mechanics superficially resemble each other (e.g. programming against contracts), the level of granularity is different.

The most important point in both systems is to be able to vary separate systems independently of each other. However, that ambition has a much more profound impact in SOA because each system may be implemented on different platforms and running on different hardware.

Imagine a 'true' SOA architecture implemented on a uniform platform (Java or .NET or similar). In this case you could conceivably collapse the architecture and run a single-box installation using in-memory message brokers, etc.

However, don't expect the reverse to hold. If you start out by writing an application that uses asynchronous messaging and what would look like a SOA architecture, there's no guarantee that you can subsequently scale it out.

There's a lot of subtle pitfalls that one tends to miss until one actually tries it out. One example is that services share data, but not class. If you don't think very hard about these things, you're likely to make some implicit assumptions about how messages are being passed around.

1
  • Services can be injected with other services; so, in that regards, services share classes or interfaces through dependency injection. Commented Aug 16, 2019 at 16:05

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.