diff --git a/.obsidian/plugins/text-extractor/cache/09345599bbeb1fd28a2a96eed50cc87f.json b/.obsidian/plugins/text-extractor/cache/09345599bbeb1fd28a2a96eed50cc87f.json new file mode 100644 index 0000000..1c18c2c --- /dev/null +++ b/.obsidian/plugins/text-extractor/cache/09345599bbeb1fd28a2a96eed50cc87f.json @@ -0,0 +1 @@ +{"path":"Attachments/Pasted image 20250117112716.png","text":"AnyGraphicsClient PCGraphicsService . . e e P U -myGraphics: PCGraphicsService +drawRectangle( +anyOperationThatDraws() +drawCircle() PCLinuxGraphicsAdapter LinuxGraphicsService E — — I —— e —— (MR +drawRectangle() +drawRect() +drawCircle() +drawCirc()","libVersion":"0.3.2","langs":"deu+eng+fra"} \ No newline at end of file diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 67cc13c..25171ce 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -537,6 +537,7 @@ }, "active": "0276c662bb61f53b", "lastOpenFiles": [ + "Attachments/Pasted image 20250117112716.png", "0 Journal/0 Daily/2025-01-17.sync-conflict-20250117-094333-LIUMLEB.md", "Attachments/Pasted image 20250117104237.png", "0 Journal/0 Daily/2025-01-17.sync-conflict-20250117-104331-LIUMLEB.md", @@ -574,7 +575,6 @@ "Dashboard Canvas.canvas", "0 Journal/Meetings/Vidit Update - 8.1.25.md", "0 Journal/0 Daily/2025-01-15.md", - "Temporary/Startup Culture List.md", "Attachments/Gym-Rings-UK.pdf", "99 Work/Jobhunt/Applications", "99 Work/0 OneSec/OneSecNotes/30 Engineering Skills/Robotics/Sensors", diff --git a/5 Media/8 Courses/Design Patterns by Construx.md b/5 Media/8 Courses/Design Patterns by Construx.md index 7185f05..74c9097 100644 --- a/5 Media/8 Courses/Design Patterns by Construx.md +++ b/5 Media/8 Courses/Design Patterns by Construx.md @@ -32,7 +32,7 @@ status: not_started --- -## Chapters +## Introduction ### Getting Started > [!definition] UML Notation @@ -183,11 +183,55 @@ Goal: objects of class T may be replaced with objects of class S without alterin - No new exceptions should be introduced in subclass S --> A subclass S must require no more and promise no less than its superclass T -Example: +Example: the contract requires must be the same or less strict (preconditions) and for the guarantees the subclass must guarantee the same or more than the superclass T (postconditions) +Be cautious about *accidental polymorphisms*: a completely different class that uses the same names. Usually the requires and guarantees are very different. This means syntax is the same, but semantics are different. Syntactically substitutionable but not semantically substitubable. +#### Design Principle: Favor Association over Inheritance +Inheritance cannot change the behaviour at run-time: a rectangle shape cannot morph into a circle shape. +## Design Patterns +Patterns are not mutually exclusive and can be used on top of each other. + +### Adapter Pattern +- No prerequisits +- Usually problems have same semantic, but a different syntax. +- Reasons: too much client code to change, code not accessible, many clients that use the same code +- Adapters are an intermediate code block that adapts the syntax between the two parts. + - meaning you have one more layer, thus slightly less performance. +- ![[Pasted image 20250117112716.png]] + - use an adapter base class (PCLinuxGraphicsAdapter) +- There is no guarantee that it is only the syntax that changes, maybe you need to adapt the semantics as well. +### Façade + +### Bridge + +### Strategy + +### Composite + +### Observer + +### Template Method + +### Factory Method + +### Abstract Factory + +### Singleton + +### Iterator + +### Proxy + +### Decorator + +### Command + +### State + +### Data Access Object --- ## Exercises diff --git a/Attachments/Pasted image 20250117112716.png b/Attachments/Pasted image 20250117112716.png new file mode 100644 index 0000000..3536e16 Binary files /dev/null and b/Attachments/Pasted image 20250117112716.png differ