![]() |
Is my code good?
Here's a link for my team's 2016 java program: https://github.com/olidem123/PLS5618
I was just wondering if there was ways to improve/make it lighter (other than clarity :cool: ). PS: We are a french canadian team so most of the program is in english. Ask me if you have questions on words. thx |
Re: Is my code good?
There is lots to like about your code. It's well organized and generally easy to read. A couple specific comments:
1. We like to use constants in RobotMap.java, organized by kind of interface. We can then print this out and use it as instructions for wiring. For example: Code:
/** You're almost there with your final references in the subsystems, but they are copies of reference and the actual controller/encoder/gyro is available to everyone. 2. In AvancerHerse, consider using more descriptive variable names: Code:
int h1 = 950;Code:
if (!Robot.pelle.herseAcotee()) {Code:
Timer.delay(0.005);4. In BrasCommand, you didn't put this in braces: Code:
} else5. Generally you want the same code in end() and interrupted() -- see Reculer. |
Re: Is my code good?
Quote:
My team intends to use Google's style guide for all our code in the future. Consistently applying rules and formatting will help with integrating and understanding code written by multiple people, and it helps students get used to the idea that they will eventually have to work in an environment where such rules are imposed. olidem123, it might be a good resource for you too :) |
Re: Is my code good?
Just some git/project related things:
I recommend you name your project something that includes the year and/or game. If you're going to be making another robot program next year, having separate names will allow you to store both projects on GitHub. For example, naming it PLS5618-Stronghold-2016 will allow you to make another project next year: PLS5618-WaterGame-2017 :) Make sure you allow your .gitignore to take effect. On your local copy of the project, commit anything if necessary, then run Code:
git rm -r --cached .Instead of having the command pair InBallon/OutBallon, which are very similar, I think it makes more sense to have a single command handle both, eg Code:
public class MoveBall extends Command { |
Re: Is my code good?
I just edited the program. https://github.com/olidem123/PLS5618-2016
Quote:
Quote:
Quote:
Quote:
Quote:
PS: I sent this post to our mentors for tips for the future years. Thx for all your support! |
Re: Is my code good?
Quote:
Code:
public enum Direction { |
| All times are GMT -5. The time now is 08:19 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi