View Single Post
  #8   Spotlight this post!  
Unread 05-01-2010, 01:40 AM
FRC4ME FRC4ME is offline
Registered User
FRC #0339
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Fredericksburg, VA
Posts: 324
FRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant future
Re: Feedback Thread: WPILib

Quote:
Originally Posted by byteit101 View Post
...
Good post. What WPI seems to have done with SensorBase is taken all of the low-level code that the user doesn't have to deal with, put it in one (or a few) base classes, and then had everything else access that code through inheritance. But that's not the purpose of inheritance, as evidenced by your post: all of that low-level code becomes as visible to the user as anything else!

At the very least, many of those methods should be made protected rather than public.

My team's DigitalInput class (which wraps around WPI's) has three public methods:

isOn() -- returns the state of the input
setReversed() -- allows us to flip the result so that it makes sense ("on" is true) based on the type of circuit connected to the input
isReversed() -- by convention, we provide a getter wherever we provide a setter

We never found a need to use the error handling and interrupt manipulation methods. But if we ever do, we will implement those functions as separate classes, as you suggest.

Of course, WPI needs a lot more code than this, but it shouldn't be visible to the user.
__________________
Go directly to queue. Do not pass pit.