I was reading about these patterns and noticed that they seem to be basically the same, but in different contexts? If that's the case, why isn't Front Controller just considered as a Mediator pattern but applied in the context of web applications?

  • 1
    basically the same, but in different contexts. Yes, the intent of the pattern influences subtile differences. This observation is explicitly mentioned in the Gang of Four book.
    – radarbob
    Commented Dec 28, 2021 at 0:55
  • 2
    "If that's the case, why isn't Front Controller just considered as a Mediator pattern but applied in the context of web applications" - Mediator is one of the classic patterns from the Go4 book; the classic patterns are more like general-purpose programming patterns. Front Controller is (if I'm not mistaken) from Fowler's Patterns of Enterprise Application Architecture, that contains a whole bunch of patterns that are somewhat more specific in nature, but are basically various usages of the classic ones. That said, Front Controller looks like a Facade to me, not Mediator. Commented Dec 28, 2021 at 10:49
  • I think Ewan's answer provides the most direct answer to your question, and Bart van Ingen Schenau's helps with a more general understanding of design patterns. IMO, taken together, they provide a comprehensive answer to your question.
    – Jason
    Commented Dec 28, 2021 at 16:17

2 Answers 2


A design pattern is not established by the structure it gives as a solution.

A design pattern provides a solution to a commonly occurring problem. If two different problems happen to have very similar looking solutions, then they are still considered to be distinct design patterns, just because they solve different problems.


In the mediator pattern you have a mediator object which handles events raised and consumed by the other objects.

ie. rather than having

MyControlOne.OnClick += myControlTwo.ChangeColour()

You have

MyControlOne.OnClick += Mediator.Raise("MyControlWasClicked")

Mediator.Listen("MyControlWasClicked", myControlTwo.ChangeColour());

This allows loose coupling of all your objects

In the Front Controller Pattern. you have a single controller that handles all incoming web requests.

   List<IHandler> handlers;

   Handle(request, response)
      foreach( h in handlers)
          h.Handle(request, response)
      return response;

Basically its what Microsoft would call a request handler. "Controller" here is used more generally that would be common in talking about web-frameworks today. Its more like if you are programming your own webserver.

It is distinct from the Mediator pattern

Not the answer you're looking for? Browse other questions tagged or ask your own question.