ChrisCScott / forecaster

A personal finances forecasting tool for Canadian retirement planning
Other
1 stars 2 forks source link

Refactor DebtPaymentStrategy to rely on TransactionStrategy #43

Closed ChrisCScott closed 5 years ago

ChrisCScott commented 6 years ago

DebtPaymentStrategy duplicates a lot of the logic of TransactionStrategy. It would be much simpler if DebtPaymentStrategy subclassed or encapsulated TransactionStrategy.

The DebtPaymentStrategy strategy methods could simply define an account order and leave it to the TransactionStrategy to execute an ordered strategy. This might be a bit tricky via encapsulation (there isn't currently a convenient way to set per-Account object weights, since weights are set by type, not instance). Subclassing might work better, but we'd need a way to de-register a strategy method. See #24 for a proposal to add such functionality.