Skip to content

Comments

Expand Software Concepts with exercises and code examples#155

Open
lujobi wants to merge 5 commits intomainfrom
feature/expand-sw_concepts
Open

Expand Software Concepts with exercises and code examples#155
lujobi wants to merge 5 commits intomainfrom
feature/expand-sw_concepts

Conversation

@lujobi
Copy link

@lujobi lujobi commented Feb 13, 2026

No description provided.

@lujobi lujobi force-pushed the feature/expand-sw_concepts branch from 36be0c4 to f888dee Compare February 13, 2026 10:37
@lujobi lujobi requested a review from langchr86 February 13, 2026 13:04
@lujobi lujobi self-assigned this Feb 13, 2026
Copy link
Contributor

@langchr86 langchr86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich habe allen neuen Code und die dazugehörigen Grafiken angeschaut. Grundsätzlich sieht das gut und verständlich aus. Trotzdem muss man sehr aufpassen, dass Beispiele nicht alzu "künstlich" aussehen. Sonst kann man sich das in der Praxis sehr schlecht vorstellen.

* Copilot über die SCS beziehen: [scs-copilot-infos]
* Immer in Absprache mit dem PL und Team, ob und wie AI-Tools eingesetzt werden dürfen.
* Wie immer mit AI-Tools: *Kritisch hinterfragen, was vorgeschlagen wird und nicht blind übernehmen!*
* Das Tool kann durchaus nützlich sein — man sollte etwas Erfahrung sammeln, wie es am besten eingesetzt werden kann.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sollten wir diesern Block eher vor Verwendung von Code aus dem Internet schieben? Weil hier wird erklärt, wie man die Coding Assistants einrichtet/verwendet. Aber nicht, welche Gefahren bestehen.


class DBTransactionRepository:
def __init__(self) -> None:
self._transactions: dict[str, Transaction] = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this example bad in the first place? Because we don't have a circular dependency.


![Factory Beispiel: vorher](images/factory/factory-bad-case.png){width=78%}

[factory-bad-case.py](code/slides/factory/factory-bad-case.py)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das war keine Änderung von dir, aber wäre es nicht schlauer, wenn wir zuerst die "Factory" einführen und erst danach das "Abstract-Factory" Beispiel haben? Zumal hier genau der gleiche "UseCase" als Beispiel verwendet wird.


Erweitert die Übung [exercise/02-03-interfaces.py](code/exercise/02-03-interfaces.py) um eine Factory,
die `Washer`-Objekte erstellt basierend darauf, ob die Items sensible sind oder nicht.
Die Factory könnte so aussehen (muss nicht zwangsläufig eine klasse sein):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Klasse"

------

Erweitert die Übung [exercise/02-03-interfaces.py](code/exercise/02-03-interfaces.py) um eine Factory,
die `Washer`-Objekte erstellt basierend darauf, ob die Items sensible sind oder nicht.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was meint "sensible"? Zerbrechlich? Dann würde ich das Deutsch schreiben und in Klammer "fragile".

if observer not in self._observers:
self._observers.append(observer)

def remove_observer(self, observer: ThemeObserver) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das das Remove nicht benützt wird und eigentlich auch nicht zwingend für das Pattern ist, würde ich das im Code und der Grafik weglassen.

pass


class ThemeObservable:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Evtl. besserer Name: ObservableTheme

class DarkThemeButton(ThemeObserver):
def __init__(self, theme_observable: ThemeObservable) -> None:
self.theme_observable: ThemeObservable = theme_observable
self.enabled: bool = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretisch könnten sich die Buttons selber als Observer registrieren.

def set_is_dark_theme(self, value: bool) -> None:
self._is_dark_theme = value
theme_name = "Dark" if value else "Light"
print(f"[Theme] Theme changed to {theme_name}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inkonsistentes Log Format.

self.theme.set_is_dark_theme(False)


if __name__ == "__main__":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Irgendwie macht das ganze Beispiel für mich wenig Sinn. Auch die Lösung sieht immer noch sehr "künstlich" aus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants