View Single Post
  #14   Spotlight this post!  
Unread 09-03-2004, 03:04
Cyris12 Cyris12 is offline
Registered User
AKA: Ajay Reddy
#0254 (Cheesy Poofs)
Team Role: Programmer
 
Join Date: Feb 2004
Location: San Jose, CA
Posts: 6
Cyris12 is an unknown quantity at this point
Send a message via AIM to Cyris12
Re: Do you write functions for your code?

There's also a lot to be said for standardized naming conventions and using #define.

Standardized naming conventions (InitializeGyro(), InitializeEncoders(), InitializeAutonomous() etc) can prevent a lot of searching to fix typos. It also increases the clarity and readability of your code.

#defines become almost essential when dealing with complicated expressions and equations. It's a lot easier to have a series of clearly labeled constants in a header file than to wade through a line wondering what 3 / 16, 82, 5, and 37 represented. Also, having constants in a header file makes changing certain often used values incredibly easier. There is no degradation in program speed because the compiler replaces the constants with the specified value at run time.