View Single Post
  #1   Spotlight this post!  
Unread 11-11-2015, 15:44
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,715
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Java Command Based Crash Course Concept

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?
Reply With Quote