Most commonly used naming conventions.

BlitzMax Forums/BlitzMax Programming/Most commonly used naming conventions.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

types:
========

type definition: T+Typename
(e.g. TColor)

a wrapper function: Create + Typename
(e.g. CreateColor)


variables:
============

variables to define of a rect: x,y,w,h

a variable to define a parent: parent

variables for generic counters: t,t2,i,i2,j,x,y,z,c

variables for strings: s, st

variables for color: r,g,b, r1,g1,b1, r2,g2,b2, grey

variables for events: ev

function/method naming:
=========================

One capital per functional bit, unless there are typically capitals in a non-code-context.

So: Colorchooser, instead of ColorChooser, as color and chooser could be (functionality-wise) two different bits.
But also: 'RGB' as functional bit, e.g. UpdateRGB. Since RGB is often written in capitals.

in/out/set/get/update/etc. things for functions and methods: with a capital, including fields, so: UpdateColorchooser, GetColorchooserColor, ResetColorchooser etc.

Indenting:
============

Apart from the usual for/next, while/wend, if/endif things I also indent the code between a setbuffer and flip. Additionally I -tend to- indent things that aren't really a scope, but do belong to something. For example, I indent the creation of menus for a menugadget, I indent filling a just declared array etc.