Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d1aedce

Browse files
committed
add Facade pattern
1 parent f9c6266 commit d1aedce

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Design Patterns in C# / .NET
44
[![Build Status](https://travis-ci.org/tk-codes/DesignPatterns.NET.svg?branch=master)](https://travis-ci.org/tk-codes/DesignPatterns.NET)
55
![Language C#](https://img.shields.io/badge/language-c%23-blue.svg)
66
![status in progress](https://img.shields.io/badge/status-in%20progress-brightgreen.svg)
7-
![number of patterns](https://img.shields.io/badge/patterns-11-red.svg)
7+
![number of patterns](https://img.shields.io/badge/patterns-12-red.svg)
88

99
## Creational Patterns
1010

@@ -25,7 +25,7 @@ Design Patterns in C# / .NET
2525
| | Bridge |
2626
|:heavy_check_mark: | [Composite](/StructuralPatterns/Composite) |
2727
|:heavy_check_mark:| [Decorator](/StructuralPatterns/Decorator) |
28-
| | Facade |
28+
|:heavy_check_mark:| [Facade](/StructuralPatterns/Facade) |
2929
| | Flyweight |
3030
| | Proxy |
3131

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Facade
2+
3+
Provide a **unifed interface to a set of interfaces in a subsystem**. Facade defines a higher-level interface that makes the subsystem easier to use.
4+
5+
## Problem
6+
7+
* To make a complex subsystem easier to use, a simpler interface should be provided for a set of interfaces in the subsystems.
8+
* The dependencies on a subsystem should be minimized.
9+
10+
## Solution
11+
12+
Define a `Facade` object that
13+
* implements a simple interface which delegates the requests to the interfaces in the subsystem
14+
* may perform additional functionality before/after forwarding a request.
15+
16+
## Benefits
17+
18+
* A facade not only simplifies an interface, it decouples a client from a subsystem of components.
19+
* Facades help layer a system.
20+
21+
## Drawbacks
22+
23+
* Duplicated methods
24+
* Lower visibility of subsystem functionality.
25+
* It leads to a larger API to maintain.
26+
27+
## Common Structure
28+
29+
![Common structure of facade pattern](https://upload.wikimedia.org/wikipedia/commons/9/96/W3sDesign_Facade_Design_Pattern_UML.jpg)
30+
31+
* Facade
32+
* knows which subsystem classes are responsible for a request.
33+
* delegates client requests to appropriate subsystem objects.
34+
* Subsystem classes
35+
* implement subsystem functionality.
36+
* handle work assigned by the Facade object
37+
* have no knowledge of the facade and keep no reference to it.
38+
39+
_[Source: http://www.dofactory.com/net/facade-design-pattern]_

0 commit comments

Comments
 (0)