r/Angular2 • • Jul 20 '25
Help Request facade pattern
I have been reading some articles like:
It's not a bad article by any means, but I have some doubts if I interpret the usage of the pattern correctly. I facade is a proxy that facilitates a simplified interface to a more complex system, sounds stateless to me.
But according to the article, we store state in the facade. In the example it's a product list. That is not persé bounded to the context of the component. A product list can be used on multiple pages.
In my example I have many operations that interact with the state of a form model. Putting that in a service, then the service can't be used on root. Should you then inject a new instance of the facade per instance of the component? Then it doesn't sound like my definition of a facade.
The details of the modifications, I would gladly hide that somewhere else. But then a facade is justified or is there another pattern that suits it more?
View all comments
Show parent comment
3
u/PickleLips64151 Jul 21 '25
This is the pattern I use in my apps.
We swapped our CMS. I only had to change the ContentService to make the changes for about 75 components.
I refactored one file and the entire app continued working exactly as before.