Skip to content

Commit

Permalink
sw_concepts: replace command example
Browse files Browse the repository at this point in the history
  • Loading branch information
BacLuc committed Apr 26, 2024
1 parent c5d1d8a commit 4567a44
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions topics/sw_concepts/images/command/command-bad-case.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@startuml

skinparam defaultFontSize 25

together {
abstract class DarkThemeButton

class DarkDarkThemeButton

class LightDarkThemeButton

abstract class LightThemeButton

class DarkLightThemeButton

class LightLightThemeButton

DarkThemeButton <|.. DarkDarkThemeButton
DarkThemeButton <|.. LightDarkThemeButton

LightThemeButton <|.. DarkLightThemeButton
LightThemeButton <|.. LightLightThemeButton
}

class ThemeObservable {
}

DarkDarkThemeButton ---> ThemeObservable
LightDarkThemeButton ---> ThemeObservable
DarkLightThemeButton ---> ThemeObservable
LightLightThemeButton ---> ThemeObservable

@enduml
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions topics/sw_concepts/images/command/command-good-case.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@startuml

skinparam defaultFontSize 25

together {
class DarkButton {
void setCommand(Command command)
}

class LightButton {
void setCommand(Command command)
}
}

together {
interface Command

class SetDarkThemeCommand

class SetLightThemeCommand

Command <|.. SetDarkThemeCommand
Command <|.. SetLightThemeCommand
}

class ThemeObservable

DarkButton --> Command
LightButton --> Command

SetDarkThemeCommand ---> ThemeObservable
SetLightThemeCommand ---> ThemeObservable

@enduml
14 changes: 13 additions & 1 deletion topics/sw_concepts/sw_concept_slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,19 @@ Observer Beispiel: nachher
Command
-------

<https://github.com/iluwatar/java-design-patterns/blob/master/command/README.md>
* Use Case:
* Man möchte von einer Funktionalität das Wie vom Wann trennen.
* Man möchte die Klasse, die ein Kommando auslöst, von der Klasse, an der das Kommando ausgeführt wird, trennen.

Command Beispiel: vorher
-------

![Observer bad case](images/command/command-bad-case.png)

Command Beispiel: nachher
-------

![Observer good case](images/command/command-good-case.png){height=90%}

Zusammenfassung Abstraktion
------
Expand Down

0 comments on commit 4567a44

Please sign in to comment.