Okay, I have done a bit of searching online and found this thread, but it still does not quite clear it up for me.
What exactly is the difference between a Front Controller Pattern and a Façade pattern?
As I understand it so far: A Façade pattern does not contain any business Logic, but merely centralizes access to multiple objects.
A Front Controller does the same thing, but may contain business logic to facilitate the decision logic of what is called based on the input data and the like.
To make sense of this, does the following simplistic pseudo code snippet mean that drawLine is a Façade to simplify converting the coordinates to points and then implementing the draw method that actually does the work?
private void drawLine(Int32 StartX, Int32 StartY, Int32 EndX, Int32 EndY)
{
Point Start = new Point(StartX, StartY);
Point End = new Point(EndX, EndY);
Draw(Start, End);
}
Can a Façade call into lower layers of your application or is it really just to centralise access to many components on the same layer?
As I understand it, the front controller coordinates the complete function call process.
Example: A Front controller would examine the data, and then decide what action to take. Then it would compile the data for each subsequent call to lower level classes, until it arrives at a suitable response that can be provided to the calling system.
I think my understanding of the Façade pattern is wrong or just too simplistic. Please correct me if I'm wrong.
If my understanding of this is correct, would it then not make more sense to change the Application Façade, into a Front Controller in the Microsoft Application Architecture Guide 2.0? I'm specifically looking at the Service Architecture in chapter 18. (I have the Beta 2 version though)
Update: Thanks for a great response Rune. Why do you say it is not correct to change the Facade to a Front controller? I'm a big fan of the Front-controller because it keeps all lower level things a little more controlled. So although it may not make MORE sense, would it be completely wrong to do that? If yes: Why?
Design Pattern - Front Controller Pattern. The front controller design pattern is used to provide a centralized request handling mechanism so that all requests will be handled by a single handler. This handler can do the authentication/ authorization/ logging or tracking of request and then pass the requests to corresponding handlers.
As I understand it so far: A Façade pattern does not contain any business Logic, but merely centralizes access to multiple objects. A Front Controller does the same thing, but may contain business logic to facilitate the decision logic of what is called based on the input data and the like.
Facade is a part of Gang of Four design pattern and it is categorized under Structural design patterns. Before we dig into the details of it, let us discuss some examples which will be solved by this particular Pattern. So, As the name suggests, it means the face of the building.
The Façade pattern, in contrast, is a design pattern (it is used to structure a specific piece of functionality your application [a module], and does not force a structure upon your whole app). And what about the MVC pattern is it not the Architectural pattern ?.
The Front Controller pattern defines a single component that is responsible for processing application requests. Often used as a "bottleneck" to (for instance) channel requests through to consolidate standard behavior that needs to be performed each time.
See these links for short to the point explanations:
A facade is on the other hand rather used to wrap other methods/services to provide a unified interface, hide complexity or reduce dependency on external systems (Exemplified in DDD's anti-corruption layer: http://www.goeleven.com/blog/entryDetail.aspx?entry=168), etc.
A facade is a thin wrapper that shouldn't contains any logic except the logic used to translate between the two systems. Front Controller has no such requirements.
See for instance: http://en.wikipedia.org/wiki/Facade_pattern
And to answer your questions concerning AppArchGuide: No, that's not correct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With