Example File.
Constants/Macros - All uppercase with _'s in between words: FOO_BAR
Procedures - First word lowercase, next camel-casing. Always use Parenthesis: fooBar()
Methods - First word lowercase, next camel-casing. First word is an action: doSomething()
Keywords - Lowercase: if, then, print, do, locate, while, wend, etc.
Namespaces - All lowercase: foo.bar
UDTs - Uppercase w/ Camel Casing: type FooBar
#includes - Follow the casing of the file: #include "fbgfx.bi"
Variables - First word lowercase, next camel-casing: fooBar
File Names - I develop from my Include folder, so the header files are MyClass.bi, while the code files are anonymous1337.package.subpackage.MyClass.bas. This way you #include as "anonymous1337\package\subpackage\MyClass.bas", install that way, and #inclib that way. It's very consistent.
Procedure Commenting and Variable Declaration:
Code: Select all
type MyType
'' I use this commenting for variables... and the declaration
'' is 'as datatype' foo
as integer foo
'' task methods
declare sub doSomething()
'' do something... this is where I lay my comments for the proc.
end type
Related Comments - I nest comments which are related (sometimes)... This is the exclusion to 'no collisions' in that if the code below the commenting is nested (such as within a DO/LOOP block), then the indentation of our comments will collide and may confuse the reader.
Code: Select all
'' create a circle
dim as Circle myCircle
'' set the position
myCircle.setPosition(320, 240)
'' set the radius
myCircle.setRadius(20)
I know that some people prefer to use do_Something rather than without spacing. Reminds me too much of Constants/Macros, but I can still read it quite easily. Someone's bound to have far better documentation than I do D: