Closed oh-yes-0-fps closed 4 weeks ago
I've added two public methods to allow users to use IntakeSimulation in the dependency injection style. The documents are also updated. https://github.com/Shenzhen-Robotics-Alliance/maple-sim/commit/9883f4125bc9a43ea3b1ee3acb003a8250337f7c
Description
Dependency injection For
IntakeSimulation
instead of inheritance.Current Code
Suggested Improvement
Implementation
Simply removing the abstract keyword from the class def could work here.
Justification
Requiring the user to or something).
Finally, having the library methods associated with a specific object and not something you are inheriting from makes it easier to
track what functions are user code and what functions are the library.
extend IntakeSimulation
when the class has no abstract methods is an odd decision. I believe it would be more intuitive and flexible simply passing in anIntakeSimulation
object, this would also allow teams that aren't doing hardware abstraction to utilize this feature(maybe using OptionalAdditional
Current workarounds
Right now you can just make an anonymous class and dependency inject that:
var simulator = new IntakeSimulation( ... ) {};
Comments
The dependency injection argument can be made for the whole library to be honest, but the abstract class with no abstract methods is what stuck out to me here.