Deprecate generic Repository interfaces in core #7

Open
opened 2026-01-26 17:52:01 +00:00 by mprihoda · 0 comments
mprihoda commented 2026-01-26 17:52:01 +00:00 (Migrated from github.com)

Summary

Deprecate the generic Repository trait hierarchy in core/shared/src/main/scala/works/iterative/core/service/Repository.scala.

Motivation

The generic Repository interfaces (GenericLoadService, GenericReadRepository, Repository, WriteRepository, CreateRepository, etc.) don't provide sufficient value to justify their complexity. We've decided to follow a Domain-Driven Design approach where:

  • Each bounded context defines its own domain-specific repositories
  • Repositories use DTOs tailored to the domain
  • Repository design is guided by domain needs, not generic abstractions

The current generic hierarchy encourages a one-size-fits-all approach that fights against proper DDD modeling.

Scope

Deprecate:

  • All traits in core/shared/src/main/scala/works/iterative/core/service/Repository.scala:

    • GenericLoadService
    • GenericUpdateNotifyService
    • GenericLoadAllService
    • GenericFindService
    • GenericReadRepository
    • GenericWriteRepository
    • GenericCreateRepository
    • GenericWriteRepositoryWithKeyAssignment
    • ReadRepository
    • WriteRepository
    • CreateRepository
    • UpdateNotifyRepository
    • Repository
    • RepositoryWithCreate
    • RepositoryWithKeyAssignment
  • Related implementations in core:

    • InMemoryRepository
    • JsStorageRepository

Not in scope:

  • Domain-specific repositories (FormReadRepository, SubmissionRepository, MessageCatalogueRepository) - these follow the correct DDD approach and will evolve independently

Migration Path

  1. Add @deprecated annotations to all generic Repository traits
  2. Update existing usages to domain-specific interfaces
  3. Provide guidance documentation for creating domain-specific repositories
  4. Remove deprecated code after migration period

Checklist

  • Add deprecation annotations with migration notes
  • Identify all usages of generic Repository traits outside core
  • Create migration guide for domain-specific repository design
  • Migrate existing code
  • Remove deprecated traits
## Summary Deprecate the generic Repository trait hierarchy in `core/shared/src/main/scala/works/iterative/core/service/Repository.scala`. ## Motivation The generic Repository interfaces (`GenericLoadService`, `GenericReadRepository`, `Repository`, `WriteRepository`, `CreateRepository`, etc.) don't provide sufficient value to justify their complexity. We've decided to follow a Domain-Driven Design approach where: - Each bounded context defines its own **domain-specific repositories** - Repositories use **DTOs tailored to the domain** - Repository design is guided by domain needs, not generic abstractions The current generic hierarchy encourages a one-size-fits-all approach that fights against proper DDD modeling. ## Scope **Deprecate:** - All traits in `core/shared/src/main/scala/works/iterative/core/service/Repository.scala`: - `GenericLoadService` - `GenericUpdateNotifyService` - `GenericLoadAllService` - `GenericFindService` - `GenericReadRepository` - `GenericWriteRepository` - `GenericCreateRepository` - `GenericWriteRepositoryWithKeyAssignment` - `ReadRepository` - `WriteRepository` - `CreateRepository` - `UpdateNotifyRepository` - `Repository` - `RepositoryWithCreate` - `RepositoryWithKeyAssignment` - Related implementations in core: - `InMemoryRepository` - `JsStorageRepository` **Not in scope:** - Domain-specific repositories (`FormReadRepository`, `SubmissionRepository`, `MessageCatalogueRepository`) - these follow the correct DDD approach and will evolve independently ## Migration Path 1. Add `@deprecated` annotations to all generic Repository traits 2. Update existing usages to domain-specific interfaces 3. Provide guidance documentation for creating domain-specific repositories 4. Remove deprecated code after migration period ## Checklist - [ ] Add deprecation annotations with migration notes - [ ] Identify all usages of generic Repository traits outside core - [ ] Create migration guide for domain-specific repository design - [ ] Migrate existing code - [ ] Remove deprecated traits
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
iterative-works/support#7
No description provided.