diff --git a/Facade/Facade.php b/Facade/Facade.php index 82fbab4..ec1dec3 100644 --- a/Facade/Facade.php +++ b/Facade/Facade.php @@ -3,23 +3,7 @@ namespace DesignPatterns\Facade; /** - * 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. - * - * The first goal is to reduce coupling and follow the Law of Demeter. - * - * 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. - * - * 1. A facade does not forbid you the access to the sub-system - * 2. You can (you should) have multiple facades for one sub-system - * - * 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 - * [Abstract|Static|Simple] Factory [Method]. * - * The best facade has no new and a constructor with interface-type-hinted parameters. - * If you need creation of new instances, use Factory as argument. * */ class Facade diff --git a/Facade/README.md b/Facade/README.md new file mode 100644 index 0000000..b7e9156 --- /dev/null +++ b/Facade/README.md @@ -0,0 +1,17 @@ +# Facade + +## Purpose + +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. +The first goal is to reduce coupling and follow the Law of Demeter. + +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. + +* A facade does not forbid you the access to the sub-system +* You can (you should) have multiple facades for one sub-system + +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 +[Abstract|Static|Simple] Factory [Method]. + +The best facade has no `new` and a constructor with interface-type-hinted parameters. +If you need creation of new instances, use a Factory as argument.