File tree Expand file tree Collapse file tree 2 files changed +17
-16
lines changed Expand file tree Collapse file tree 2 files changed +17
-16
lines changed Original file line number Diff line number Diff line change 3
3
namespace DesignPatterns \Facade ;
4
4
5
5
/**
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].
20
6
*
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.
23
7
*
24
8
*/
25
9
class Facade
Original file line number Diff line number Diff line change
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.
You can’t perform that action at this time.
0 commit comments