๐‚๐ก๐จ๐ซ๐ž๐จ๐ ๐ซ๐š๐ฉ๐ก๐ฒ & ๐Ž๐ซ๐œ๐ก๐ž๐ฌ๐ญ๐ซ๐š๐ญ๐ข๐จ๐ง

ยท

2 min read

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.

diagram

ย