WARNING: THIS MAY CAUSE EXPERIENCED PROGRAMMERS TO SHAKE VIOLENTLY IN ANGER
Scenario: Given two hours to teach a group of new programmers how to code their robot using the Java Command Based structure.
Some new programmers will struggle with the concept of writing their own methods in the Subsystem classes. Given the short amount of time what are the thoughts on declaring all of the motors and sensors inside of a Subsystem as public fields. Then accessing them directly from the Commands that need them?
Code:
public class Drivetrain extends Subsystem {
public MotorController left = new Talon(0);
public MotorController right = new Talon(1);
public RobotDrive drive = new RobotDrive(left, right);
}
Code:
public class DriveCommand extends Command {
protected void execute() {
Robot.drive(Robot.oi.joystick);
}
}
I know this breaks many Java programming standards and should be highly frowned upon by an experienced programmer. But, thoughts and opinions?