-
-
Notifications
You must be signed in to change notification settings - Fork 27
[ARCH] Replace heaviest traits in ClientHandler with injected collaborator objectsΒ #111
Copy link
Copy link
Open
Labels
architectureStructural or design-level changeStructural or design-level changedependenciesPull requests that update a dependency filePull requests that update a dependency fileneeds-triageNeeds review before work beginsNeeds review before work beginspriority: mediumCode quality, completeness, or maintainabilityCode quality, completeness, or maintainabilityrefactorRestructures code without changing behaviourRestructures code without changing behaviourstaleNo activity for 60+ daysNo activity for 60+ daystech-debtAccumulated shortcuts that need to be paid downAccumulated shortcuts that need to be paid down
Description
Activity
Metadata
Metadata
Assignees
Labels
architectureStructural or design-level changeStructural or design-level changedependenciesPull requests that update a dependency filePull requests that update a dependency fileneeds-triageNeeds review before work beginsNeeds review before work beginspriority: mediumCode quality, completeness, or maintainabilityCode quality, completeness, or maintainabilityrefactorRestructures code without changing behaviourRestructures code without changing behaviourstaleNo activity for 60+ daysNo activity for 60+ daystech-debtAccumulated shortcuts that need to be paid downAccumulated shortcuts that need to be paid down
Priority: π‘ Medium
Description
ClientHandlercurrently composes 10 traits (see also issue #94 β MED-6). While that issue covers the immediate static analysis and maintainability concern, the deeper architectural goal is to move from implicit trait coupling to explicit dependency injection.The three heaviest traits are the best candidates for extraction into standalone collaborator classes:
PerformsHttpRequestsManagesPromisesManagesRetriesManagesConnectionPoolWith injected collaborators,
ClientHandlerbecomes:This makes dependencies explicit, enables mocking individual concerns in tests, and eliminates the implicit shared-state problem.
Recommended Approach
This is a significant refactor best done in phases:
ManagesPromisesandManagesRetries(fewer dependencies on handler state)ManagesConnectionPoolPerformsHttpRequests(coordinate with CRIT-2 resolution)Preserve the existing public API throughout β the extraction should be transparent to callers.
Related
Issue #94 β MED-6: God Class via 10 trait compositions
Issue #80 β CRIT-2: PerformsHttpRequests God Trait