Instead of forcing users to manually call constructors with new, static factories wrapping the different control request types would improve readability:
motor.setControl(dutyCycle(1.0));
// compare to:
motor.setControl(new DutyCycleOut(1.0));
Implementation and maintenance cost for the static factories should be basically zero.
Instead of forcing users to manually call constructors with
new
, static factories wrapping the different control request types would improve readability:Implementation and maintenance cost for the static factories should be basically zero.