Skip to content

Segregate Notifier interface using Interface Embedding (ISP) #5

@LXSCA7

Description

@LXSCA7

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.

Metadata

Metadata

Assignees

Labels

coreArchitectural changes that affect the foundation of the project (Domain, Ports, Services).enhancementNew feature or requestinternalReserved for project maintainers. Please do not open PRs for this issue.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions