Stepster Code Standards

Home
Up

 

 

I'd like to propose some code standards for Stepster in order to make life a little easier for all developers working on the code

I've been using Visual SourceSafe as my source code archive. If you wish to use it it can be gotten from Microsoft.
I usually do NOT edit the code in the PowerBasic environment. In fact, I usually use TextPad as my editor. It has a color syntax highlight module available for PowerBasic, and can be configured to be keystroke compatible with Microsoft Applications, or many other editors.

  • Tab Stops should be set to 4
  • No more than one statement per line - Exceptions:When you have a Locate statement immediately followed by a print statement
  • Comments should start with ' not rem
  • Inline comments (The ones at the end of lines) should begin in column 53 is the source code ends by that line
  • Use subroutines and functions instead of Goto and Gosub - One of the main goals at this point is to get rid of the gotos and gosubs
  • Use Block IF statements. It is MUCH easier to read and edit
    IF block = 1 THEN
        COLOR action
        LOCATE 10, 28: PRINT "BLOCK MODE "
        RETURN
    end if
    								
    than
    IF block = 1 THEN COLOR action: LOCATE 10, 28: PRINT "BLOCK MODE ": RETURN
    								
  • COMMENT YOUR CODE
    One thing I've learned after having been a programmer for more than 17 years now, is that code comments don't take time, they save time. The first time you have to fix some code you haven't looked at in a year or two, you'll tank me
  • Standard Naming
    • Spell out variable names, capitalizing the first letter of each word. Just because you know what cosys is doesn't mean the next coder will. CoordinateSystem is much easier to understand.
    • Use the DIM statement to declare all variables (also on the list "to do")
    • integers will begin with a lower case i (eg: iCoordinateSystem)
    • single precision numbers begin with a lower case n
    • longs begin with a lower case l
    • doubles with a lower case d
    • strings with a lower case s
    • PowerBasic for DOS does not support the boolean data type, so use an integer, BUT prefix the variable with a lower case b. This will make it easier to port the project in the future