Skip to content

Commit d618d20

Browse files
author
Dominik Liebler
committed
README Facade
1 parent 0224d6d commit d618d20

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

Facade/Facade.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,7 @@
33
namespace DesignPatterns\Facade;
44

55
/**
6-
* The primary goal of a Facade Pattern is not to avoid you to read the manual of
7-
* a complex API. It's only a side-effect.
8-
*
9-
* The first goal is to reduce coupling and follow the Law of Demeter.
10-
*
11-
* A Facade is meant to decouple a client and a sub-system by embedding
12-
* many (but sometimes just one) interface, and of course to reduce complexity.
13-
*
14-
* 1. A facade does not forbid you the access to the sub-system
15-
* 2. You can (you should) have multiple facades for one sub-system
16-
*
17-
* That's why a good facade has no "new" in it. If there are multiple creations
18-
* for each method, it is not a Facade, it's a Builder or a
19-
* [Abstract|Static|Simple] Factory [Method].
206
*
21-
* The best facade has no new and a constructor with interface-type-hinted parameters.
22-
* If you need creation of new instances, use Factory as argument.
237
*
248
*/
259
class Facade

Facade/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Facade
2+
3+
## Purpose
4+
5+
The primary goal of a Facade Pattern is not to avoid you to read the manual of a complex API. It's only a side-effect.
6+
The first goal is to reduce coupling and follow the Law of Demeter.
7+
8+
A Facade is meant to decouple a client and a sub-system by embedding many (but sometimes just one) interface, and of course to reduce complexity.
9+
10+
* A facade does not forbid you the access to the sub-system
11+
* You can (you should) have multiple facades for one sub-system
12+
13+
That's why a good facade has no `new` in it. If there are multiple creations for each method, it is not a Facade, it's a Builder or a
14+
[Abstract|Static|Simple] Factory [Method].
15+
16+
The best facade has no `new` and a constructor with interface-type-hinted parameters.
17+
If you need creation of new instances, use a Factory as argument.

0 commit comments

Comments
 (0)