View Single Post
  #3   Spotlight this post!  
Unread 17-12-2013, 01:15
jmullins16's Avatar
jmullins16 jmullins16 is offline
Registered User
AKA: Jeff Mullins
FRC #2135 (Presentation Invasion)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2011
Location: San Jose, CA
Posts: 23
jmullins16 is an unknown quantity at this point
Re: C++ Toggle Button

Very nice answer. And to bring out a couple more subtle points displayed in the answer that will help understandability.

- Don't be afraid to use a bit more whitespace. Parentheses, brackets, and keywords all deserve attention and the whitespace gives the user visual focus. The answer example has a good balance of spacing.

- The code for managing the toggling is now grouped very tight and easily understood without paging around the drive code packed into it. This can be maintained by either putting the drive code into their own sub-functions, or simply making a new section immediately after the toggling code which re-checks the arcade/tank enum solely for the purpose of doing just the drive functions. There is no penalty for re-checking a value such as this.
Reply With Quote