Codecat15
1 min readJul 22, 2024

--

The article describes the Facade pattern rather than API composition, which makes the title misleading.

A significant issue as already addressed by others with this approach is that the facade, referred to as composition in the article, will become unwieldy as it grows.

This is because the facade must handle all error codes from multiple services and be aware of all error codes, and behaviors of these services etc .

Additionally, the facade acts as an orchestrator, managing the sequence of service calls and handling failures, which adds complexity to its logic.

This pattern can lead to considerable maintenance challenges.

Instead of creating a large, monolithic class, I suggest keeping the services cohesive by avoiding dumping all the logic in one place.

If you need to call 5 different services from different sources you can use command, chain of responsibility or mediator pattern depending on your use case than a facade pattern.

--

--

Codecat15
Codecat15

No responses yet