W6: Pattern: Facade

The pattern Facade is part of structural design patterns.

Some subsystems contain several classes which are in close relation to each other. Since most classes of this subsystem are not commonly used without any other classes, there is no need to access them. The Facade then defines an consistent programming interface from which selected methods can be accessed.

Those methods are called delegate methods which keep the full access inside the subsystem. Thus handling of a Facade appears to be very easy.

Advantages

  • less dependency (hidden subsystem)
  • less complexity (consistent interface)
  • easy to expand

Disadvantage

  • adds another layer (more indirect)

Android App (small) example: WaveEffect

SmartSelect_20180528-233132_react.gif
WaveEffect in action
Facade before
before
Facade after
after

Code example (WaveEffect and how it affects SpriteMapObject)

facade
WaveEffect and SpriteMapObject before and after

6 thoughts on “W6: Pattern: Facade”

  1. Hey,
    your pattern looks good, but if i remember correctly, on the slides in class it was said singletons and facades are a no-go.
    However, on the slides available in the central, facades are not mentioned as no-go, so maybe the slides differ or we’re simply wrong. But still, your work looks good.

    Greetings,
    NeCo

    Like

    1. Hey NeCo,

      thanks for your comment. I’m not quite sure… we just checked the slides in the central, where, as you already mentioned, it was not forbidden.

      I guess we’ll see soon!

      Like

  2. Hey guys,

    your blog entry looks good, short explanation of your pattern and how it changed your UML diagram.
    Content wise I would like a real code example, so you can see the code before the use of the pattern and after. If you do this it is much easier to understand your pattern.
    Another things is quite a few typos. An easy solution is to mark your text, right click, “Rechtschreibprüfung” and choose English and correct your mistakes 🙂

    best regards

    DFFC

    Like

    1. Hey DFFC,

      I did this post quite late in the evening… thank you very much. It only were two typos… silly typos 🙂
      We will add a screenshot of the code soon!

      Like

  3. Hey there,
    we loved your blog entry. The changes you made seem very useful and to the point.
    It is nice that you added some explanation and imagery to convey the reasoning behind your patterns better.

    Best regards,
    Team PPR

    Like

Leave a reply to freshmangoshake Cancel reply

Design a site like this with WordPress.com
Get started