Quote:
Originally Posted by tcjinaz
To better understand the tools I'm learning this year, might not Eclipse flag this sort of disparity? At least flagging the reference/overload/whatever of the deprecated method? It has certainly not been shy about letting me know when I lay in a deprecated anything.
Just an uneducated question from a Java/Eclipse rookie.
Tim
|
The idea is that every motor controller implements the speedcontroller interface. This means they all have the same functions but the functions work differently between say a talon and a jaguar.
This allows the RobotDrive class to say "i want a speedcontroller but i dont care which one."
very useful but it needs to be used carefully. This is where things get tricky for me, so if im wrong someone will need to correct me.
The issue in this case is that jaguars have "syncgroups" and regular talons dont. However the speed controller interface defines the set method that uses syncgroups, so every class extending it now has to at least define it, whether or not it is actually something it uses or not.
I mean, imagine if you passed a talon into the drive code, and it tried to use that set method, and it just wasnt there.
So instead of rewriting everything that used motor controllers to make it choose whether or not to use sync groups based on what kind of controller it was, they left the original "set(speed,syncgroup)" method in for classes that didnt use syncgroups (such as the talon), and had it do the same thing that set(speed) did and ignore the syncgroup variable. Call it deprecated and be done with it.
Drive code can still give the talons a syncgroup and you can just ignore the deprecated method when writing your own code. nothing is technically wrong.
I feel that a better way to write this however would be to have the deprecated method simply call the new one and throw out the syncgroup, instead of copy pasting the code. This means that no matter what happens, both functions have to do the same thing for classes without syncgroups so extending either function works, otherwise you get confused teams.