Question

In my applications, I used to call Facade methods in the main application using they as Controllers because I thought they are the same thing, but now I think I was wrong.

My application use multiple Facades, each one for a kind of task. If I change to use the Controller, the right way is having only one Controller?

My question here is what is the difference between a Facade and a Controller.

Was it helpful?

Solution

Normally it would be the other way around, as you tend to have fewer facades in your system then controllers. Facades are meant to be wrappers around complex functionality, their primary goal is hiding complexity of an underlying system. You can think of the Facade as a layer wrapping the complex functionality and providing simpler methods to interact with.

A controller, on the other hand, is normally tied to a very specific piece of functionality in the system. It's main goal is to mediate the interaction between a view and a model, or in some cases just a model.

It's more typical to have a facade interacting with several controllers, than vice versa.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top