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.

Our types are named in the fashion: <qualifier><type><name>, where qualifier is usually as or ww, Type is either 'C' for concrete class, A for abstract class or I for interface.

References to these are named <qualifier><type><name> where type is any capital letters in the class name.

Variables or references to other peoples objects use simple Hungarian notation.

Here is an example from our Logging module:
SuperStrict

'{module}

Import BRL.Stream
Import BRL.FileSystem
Import BRL.System
Import BRL.Retro
Import BRL.Blitz

Type asCLog
	Global aslMyInstance:asCLog
	Field tsOut:TStream
	Field iDebugLevel:Int = LEVEL_CRITICAL | LEVEL_INFO | LEVEL_DEBUG
	
	Const LEVEL_CRITICAL:Int = 1
	Const LEVEL_INFO:Int = 2
	Const LEVEL_DEBUG:Int = 3
	
	Function create(sFilePath:String)
		If aslMyInstance <> Null
			cleanup
		EndIf
		aslMyInstance = New asCLog
		If FileType ( sFilePath ) = 0
			CreateFile( sFilePath )
		EndIf
		aslMyInstance.tsOut = OpenFile( sFilePath )
		aslMyInstance.tsOut.seek(aslMyInstance.tsOut.size())
		aslMyInstance.info("*** Logging initiated ***")
	EndFunction
	
	Function getInstance:asCLog()
		If aslMyInstance = Null
			create("debug.log")
			OnEnd cleanup
		EndIf
		Return aslMyInstance
	EndFunction

	Method critical(sMessage:String)
		If iDebugLevel & LEVEL_CRITICAL
			write( "CRITICAL" , sMessage)
		EndIf
	EndMethod

	Method info(sMessage:String)
		If iDebugLevel & LEVEL_INFO
			write("INFO" , sMessage)
		EndIf
	EndMethod

	Method debug(sMessage:String)
		If iDebugLevel & LEVEL_DEBUG
			write("DEBUG" , sMessage)
		EndIf
	EndMethod

	Method write(sSeverity:String , sMessage:String)
		WriteLine(tsOut , LSet( sSeverity , 10) + CurrentDate()+" [" + CurrentTime() + "]  :  " + sMessage)
		FlushStream(tsOut)
	EndMethod

	Method close()
		CloseStream(tsOut)
	EndMethod
	
	Function cleanup()
		If asCLog.aslMyInstance <> Null
			asCLog.getInstance().info("*** Logging session ended ***")
			asCLog.getInstance().close
		EndIf
	EndFunction
EndType