Front Controller vs. Façade pattern

前端 未结 2 1922
情深已故
情深已故 2021-02-01 09:06

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 Control

2条回答
  •  忘掉有多难
    2021-02-01 09:32

    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:

    • http://java.sun.com/blueprints/patterns/FrontController.html
    • http://www.oracle.com/technetwork/java/frontcontroller-135648.html
    • http://martinfowler.com/eaaCatalog/frontController.html

    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.

提交回复
热议问题