Quote:
Originally Posted by legts
I did not notice that before, thanks for pointing that out!
|
This is one of the important reasons to follow programming style conventions - that is, make your code
look like programmers expect. In this case, the usual convention for objects is that the commas are only used if they are
not being set. It's also common to keep columns aligned as you go down parallel code; this is why code is traditionally displayed in a fixed-width font. The usual style conventions would look like:
Code:
Button button1 = new JoystickButton(joystick, 1);
Button button2 = new JoystickButton(joystick, 2);
Button button3 = new JoystickButton(joystick, 3);
Button button4 = new JoystickButton(joystick, 4);
Button button5 = new JoystickButton(joystick, 5);
Button button6 = new JoystickButton(joystick, 6);
Button button7 = new JoystickButton(joystick, 7);
Button button8 = new JoystickButton(joystick, 8);
Button button9 = new JoystickButton(joystick, 9);
Button button10 = new JoystickButton(joystick, 10);
Button button11 = new JoystickButton(joystick, 11);
Following programming style conventions is nearly as important as following wiring color code conventions, and for exactly the same reason -- so that the guy (or gal) who comes behind you can easily figure out what you did. So far, it's not the law, or even in the FRC rules, but maybe it should be. Or maybe not -- do we really want code inspectors?