From e440f128a549eecf8f7c13806b40124ebe0cb337 Mon Sep 17 00:00:00 2001 From: Claudio Fritsche Date: Fri, 17 Jan 2025 14:08:14 +0100 Subject: [PATCH] vault backup: 2025-01-17 14:08:14 --- 5 Media/8 Courses/Design Patterns by Construx.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/5 Media/8 Courses/Design Patterns by Construx.md b/5 Media/8 Courses/Design Patterns by Construx.md index dcd3f95..5dfe4df 100644 --- a/5 Media/8 Courses/Design Patterns by Construx.md +++ b/5 Media/8 Courses/Design Patterns by Construx.md @@ -218,9 +218,22 @@ Patterns are not mutually exclusive and can be used on top of each other. > - portability across multiple providers > - two versions: object vs class adapter -### Façade +Interesting application: +In testing you might want to test hidden / private functions. So you can create a inherited object lets call it test-object, where those functions are exposed. So the test-object is basically an adapter. +### Façade (also called Wrapper) +Build a wrapper around a complex service to simplify the interface. +- Depending on the language you might not be able to preventing the client to go around the facade. +- An adapter can be a wrapper. It all depends on your intent: + If your intent is syntax adapting it is an adapter. + If your intent is hiding complexity it is a wrapper. + It can be both at the same time if your intent is to do both at the same time +#### Design principles +- Encapsulation +- Abstraction (hide details that are not needed) +- High cohesion / loose coupling (secondary, decouple the service provider) ### Bridge +**Prerequisite**: Adapter Pattern ### Strategy