|
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.
|