My application is a Java program that controls a robot (which is essentially a raspberry pi hooked up to a lot of devices). There are many devices on the robot that have semi constant address values or pin numbers. Currently in our codebase you'll see a lot of static constants defined like:
static final long SLEEP_DURATION = 100;
static final byte MOTOR_CONTROLLER_ADDRESS = 0x01;
static final byte TOOLING_MOTOR_1_CHANNEL = 15;
static final byte TOOLING_MOTOR_2_CHANNEL = 12;
The problem is that when we're hooking up all the wires in the robot, we might accidentally swap tooling motor 1 and 2. Our current options when this happens are to rewire the robot (time consuming) or recompile the robot code and re-upload it to the robot (also time consuming).
After looking at some libraries I think I could use the Commons Configuration Library to read in a properties file for these values.
final byte toolingMotor1Channel;
final byte toolingMotor2Channel;
...
toolingMotor1Channel = config.getByte("motorcontroller.toolingmotor1");
toolingMotor2Channel = config.getByte("motorcontroller.toolingmotor2");
This doesn't add too much complexity to the code, but it does add some. So my question is:
Does it then make sense to have variables like SLEEP_DURATION
or MOTOR_CONTROLLER_ADDRESS
be configurable as well? It is possible that these values might be changed in the future, however, it is unlikely. Where do I draw the line with what gets configured from this library?