The CoreSolver class conflates mutating internal state with returning values from the same methods. This makes unit testing individual methods difficult and creates unclear contracts.
Problem
As Tim noted: 'there is the confluence of mutating state and returning state that I think makes it a nightmare to unit test the class currently' — e.g., methods that both mutate self and return a property of self (L772).
Proposed direction
Related
Ref: PR #18 review by @TimothyWillard (L1, L772)
The
CoreSolverclass conflates mutating internal state with returning values from the same methods. This makes unit testing individual methods difficult and creates unclear contracts.Problem
As Tim noted: 'there is the confluence of mutating state and returning state that I think makes it a nightmare to unit test the class currently' — e.g., methods that both mutate
selfand return a property ofself(L772).Proposed direction
selfand returnNone, or compute and return a value without side effectsCoreSolverbuilds the plan, a separateSolverResultholds outputLinearSolverBackendprotocol and tighten operator contracts #19, Inject backend intoCoreSolver#21, Protocol-first backend abstraction for swappable solver backends #26) which already plans to inject backends and define protocolsRelated
Ref: PR #18 review by @TimothyWillard (L1, L772)