BLlakers / 2024_Official

Other
2 stars 1 forks source link

Jared/Organization Issues with Variable Naming #3

Closed dlezcan1 closed 4 months ago

dlezcan1 commented 5 months ago

On many files, the renamed variable names are renamed to actual class name, which can confuse software. These should be renamed to a name that is not their class name. Examples that are found are:

https://github.com/BLlakers/2024_Official/blob/73e1cab202032ac3afbad7ddc6cfd1d6b3623160/src/main/java/frc/robot/RobotContainer.java#L36-L38 https://github.com/BLlakers/2024_Official/blob/73e1cab202032ac3afbad7ddc6cfd1d6b3623160/src/main/java/frc/robot/subsystems/DriveTrain.java#L129 https://github.com/BLlakers/2024_Official/blob/73e1cab202032ac3afbad7ddc6cfd1d6b3623160/src/main/java/frc/robot/commands/SwerveDriveCommand.java#L21-L22 https://github.com/BLlakers/2024_Official/blob/73e1cab202032ac3afbad7ddc6cfd1d6b3623160/src/main/java/frc/robot/subsystems/DriveTrain.java#L143

These have repeated variable names, one scoped inside function, the other in the class member. It is better to name non-static member variables m_XXXXX, and static member variables, s_YYYY. This avoids any naming conflicts and makes it easily readable which variables are static and are members. https://github.com/BLlakers/2024_Official/blob/73e1cab202032ac3afbad7ddc6cfd1d6b3623160/src/main/java/frc/robot/commands/SwerveDriveCommand.java#L66-L68

dlezcan1 commented 5 months ago

One thing that could be helpful is understanding how some example swerve drive code has worked, so that we can have better consistency. Here is a repository I found helpful:

https://github.com/frc3512/SwerveBot-2022

dlezcan1 commented 5 months ago

Also helpful examples of SparkMax Java code: https://github.com/REVrobotics/SPARK-MAX-Examples/tree/master/Java