|
| 1 | +# Facade Structural Design Pattern |
| 2 | +> hides the complexities of the system by a class that provide a simple interface to a complex subsystem which contains lots of moving parts. |
| 3 | +
|
| 4 | +<center><table> |
| 5 | + <tr> |
| 6 | + <td><img src="assets/Facade_Design_Pattern_Class_Diagram_UML_wikipedia_2.png"></td> |
| 7 | + <td><img src="assets/Facade_Design_Pattern_Sequence_Diagram_UML_wikipeda.png"><td> |
| 8 | + <td><img src="assets/Example_of_Facade_design_pattern_in_UML.png"></td> |
| 9 | + </tr> |
| 10 | +</table></center> |
| 11 | + |
| 12 | +<center><img width=75% src="assets/facade-diagram.png"></center> |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +## Sections |
| 17 | +- [Definitions](#Definitions) |
| 18 | +- [What Problem Facade Solve?](#What-Problem-Facade-Solve?) |
| 19 | +- [Examples](#Examples) |
| 20 | + - [file converter example ](#file-converter-example) |
| 21 | + - [Shape Marker](#Shape-Marker) Tutorial point Example |
| 22 | +- [Sources](#Sources) |
| 23 | + |
| 24 | + |
| 25 | +## **Definitions** |
| 26 | + <dl> |
| 27 | + <dt><b>tutorialspoint </b></dt> |
| 28 | + <dd> |
| 29 | + <li>is a structural pattern.</li> |
| 30 | + <li> this pattern adds an interface to existing system to hide its complexities.</li> |
| 31 | + <li> and provides an interface to the client using which the client can access the system.</li> |
| 32 | + </dd> |
| 33 | + <dt><b>refactoring.guru </b></dt> |
| 34 | + <dd> |
| 35 | + <li>a structural pattern</li> |
| 36 | + <li>provides a simplified interface to a library, a framework, or any other complex set of classes.</li> |
| 37 | + </dd> |
| 38 | + </dd> |
| 39 | + <dt><b>Wikipedia </b></dt> |
| 40 | + <dd> |
| 41 | + <li>a structural pattern</li> |
| 42 | + <li>provides a simplified interface to a library, a framework, or any other complex set of classes.</li> |
| 43 | + </br> |
| 44 | + <li>Facade describe how to solve recurring design problems</li> |
| 45 | + <li>to design flexible and reusable object-oriented software, that is, objects that are easier to implement, change, test, and reuse.</li> |
| 46 | + </dd> |
| 47 | +</dl> |
| 48 | + |
| 49 | +</br> |
| 50 | + |
| 51 | +## **What Problem Facade Solve?** |
| 52 | + |
| 53 | +- Imagine that you must make your code work with a broad set of objects that belong to a sophisticated library or framework. |
| 54 | +- Ordinarily, you’d need to initialize all of those objects, keep track of dependencies, execute methods in the correct order, and so on. |
| 55 | + |
| 56 | +> As a result, the business logic of your classes would become tightly coupled to the implementation details of 3rd-party classes, making it hard to comprehend and maintain. |
| 57 | +
|
| 58 | +--- |
| 59 | + |
| 60 | +### Solution |
| 61 | +- A facade is a `class` that provides a simple interface to a complex subsystem which contains lots of moving parts. |
| 62 | +- A facade might provide limited functionality in comparison to working with the subsystem directly. |
| 63 | +- However, it includes only those features that clients really care about. |
| 64 | + |
| 65 | +- Having a facade is handy when you need to integrate your app with a sophisticated library that has dozens of features, but you just need a tiny bit of its functionality. |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +## **Examples** |
| 70 | + |
| 71 | +### file converter example |
| 72 | + - Example in dart: <a href="file converter example ="_blank">file converter example </a> |
| 73 | + - Example Source: |
| 74 | + - <a href="https://refactoring.guru/design-patterns/bridge" target="_blank" >https://refactoring.guru/design-patterns/bridge</a> |
| 75 | + - <a href="https://www.tutorialspoint.com/design_pattern/bridge_pattern.htm" target="_blank" >https://www.tutorialspoint.com/design_pattern/bridge_pattern.htm</a> |
| 76 | + |
| 77 | +### Shape Marker |
| 78 | +- source: <a href="https://www.tutorialspoint.com/design_pattern/facade_pattern.htm" target="_blank">tutorialspoint.com/design_pattern/facade_pattern</a> |
| 79 | +- Example in dart: <a href="shape_marker.dart" target="_blank">Shape Marker</a> |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | +## **Sources** |
| 84 | + |
| 85 | +- <a href="https://en.wikipedia.org/wiki/Facade_pattern" target="_blank"> wikipedia.org Facade_pattern</a> |
| 86 | +- <a href="https://refactoring.guru/design-patterns/facade" target="_blank"> refactoring.guru design-patterns facade</a> |
| 87 | +- <a href="https://www.tutorialspoint.com/design_pattern/facade_pattern.htm" target="_blank"> www.tutorialspoint.com facade_pattern </a> |
| 88 | + |
0 commit comments