The current ports.Notifier interface is a "fat interface" (it has too many responsibilities). Every new adapter (like the upcoming Gotify one) is forced to implement methods like SendPhoto or CreateCategory, even if they don't support these features.
Proposed Solution:
- Apply the Interface Segregation Principle (ISP) by breaking the Notifier into smaller, specialized interfaces and using Interface Embedding for more powerful adapters.
New Structure:
- Notifier: Basic text notifications.
- Support for SendPhoto (embeds Notifier).
- Support for CreateCategory (embeds Notifier).
Impact:
- Easier for new contributors to create simple adapters.
- Decoupled Core: The service layer can now use type assertion to check for capabilities (if v, ok := n.(ports.VisualNotifier); ok { ... }).
Note: To be implemented after merging the Gotify PR to avoid merge conflicts for contributors.
The current ports.Notifier interface is a "fat interface" (it has too many responsibilities). Every new adapter (like the upcoming Gotify one) is forced to implement methods like SendPhoto or CreateCategory, even if they don't support these features.
Proposed Solution:
New Structure:
Impact: