Go to Post This our big chance to spread the word and change the culture, let's not waste it. So in the words of one Leroy Jenkins, "Time's up, let's do this." - Frenchie461 [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Spotlight this post!  
Unread 22-05-2016, 19:45
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 296
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Code Review: Semi-Novice

This isn't really a code thing, but it's best practice in git to exclude anything binary (your bin, build, and dist) folders. You can use a .gitignore file to do this.

General
- You've got some redundant/unnecessary classes. Instead of things like IntakeIn and IntakeOut you could have a generic IntakeRoll that accepts an enum parameter for in or out.
- When using booleans in if blocks, you don't need an "== true"
So instead of
Code:
if(pSwitch.get() == true) { ... }
You'd do
Code:
if(pSwitch.get()) { ... }
And instead of
Code:
if(RobotMap.intakeOutSwitch.get() == false) { ... }
You'd do
Code:
if(!RobotMap.intakeOutSwitch.get()) { ... }
OI.java
- Using an array of joystick buttons might be neater

Robot.java
- What is pSwitch? A better variable name would help. Also the channel is hardcoded
- You store joystick buttons here. Those should be in OI

RobotMap.java
- You name some channel numbers "driveVictorX" and then create a Talon object with them
- Then you name your lift motor channel "liftTalon" and create a Victor from it
- Intake switches are hardcoded

Subsystems
- I agree with the design choice of having subsystems store hardware objects (instead of RobotMap), but it's really up to you.

Note that these are best practices/recommendations. It's difficult to write software well, and even our own code doesn't really meet these standards (especially as we piled on more and more mid-competition hacks)

Last edited by euhlmann : 22-05-2016 at 19:48.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:37.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi