๐๐ก๐จ๐ซ๐๐จ๐ ๐ซ๐๐ฉ๐ก๐ฒ & ๐๐ซ๐๐ก๐๐ฌ๐ญ๐ซ๐๐ญ๐ข๐จ๐ง
A Modular architecture consists of several modules that may collaborate with each other in order to achieve a common goal.
In order for modules to collaborate with each other they must settle on a communication style, such communication can be in a direct form where one module directly communicates with another or it can be in a more implicit form such as that via a mediator.
๐๐ก๐จ๐ซ๐๐จ๐ ๐ซ๐๐ฉ๐ก๐ฒ: A communication style where modules directly communicate with one another.
๐๐ซ๐๐ก๐๐ฌ๐ญ๐ซ๐๐ญ๐ข๐จ๐ง: A communication style where modules communicate via a mediator.
As with everything in software architecture, each approach offers a set of trade-off and neither are perfect, therefore an analysis can be performed to determine which is more suitable given a specific context.
๐๐๐ซ๐๐จ๐ซ๐ฆ๐๐ง๐๐: The more services a message passes through the more overhead is added, such overhead decreases performance, therefore, choreography offers better performance than orchestration as communication is more direct.
๐๐จ๐ฎ๐ฉ๐ฅ๐ข๐ง๐ : There seems to be a difference of opinion around which style creates more coupling. Some argue that Orchestration approaches result in loose coupling between modules, as introducing an intermediary that sits between modules provides a level of isolation, therefore changes become isolated to the mediator and do not ripple to other services.
While others claim the opposite; Iโm interested to hear your opinions on the matter.
๐๐จ๐ฆ๐ฉ๐ฅ๐๐ฑ๐ข๐ญ๐ฒ: In the event where one module is required to collaborate with an increased number of modules then the responsibility of such module grows not only to cover its own workflows but also to coordinate with each collaborating module, this growth increases complexity, such complexity can be reduced by leveraging orchestration as the mediator becomes in charge of coordination and error handling between modules.
๐๐๐ฅ๐ข๐๐๐ข๐ฅ๐ข๐ญ๐ฒ: When orchestration relies on a central coordinator, the central coordinator becomes a single point of failure of the entire system, therefore measures should be taken in such cases to ensure high availability.
A hybrid approach can be leveraged in a single architecture where most suited, therefore some modules may communicate directly while others via a mediator.