It's simply how you give name to your variables ! What method, to make difference between to type of variables or to type of objects.
Most of the time, bad calling convention goes from pair with a bad code.
By default, Gambas give a default name to the widgets, like button1, textbox1, etc... and then incrementing the value when you add a new component in the IDE. But the problem with this system is that your code is really difficult to interpret or to debug...
But all is not lost at this time... i've maybe a soluce for you :-).
The hungarian convention is a good one. You have probably seen this convention in some Microsoft Visual Basic exemples sources. I don't say it's the better one, but i've use it in some other languages php, fortran, and it got fine on Gambas.
All the users of the hungarian convention that i know have in a first time hated it. But whatever your opinion is, you will not regret having learned to read Hungarian. This convention was created by Charle Simonyi, veteran of developement at Microsoft and and Hungarian of birth. It implies that the variables comprises two parts: a basic type in small letters indicating the kind of variable, and a qualifier with initial in capital letter which distinguishes a variable of the other of the same variables. Then you can a letter like $ at the end to distingish the global variables.
An integer variable that will be used to locate something iPos An integer variable that will be used to locate something in a file and another in a textarea iFilePos iLinePos A form for save a file as... frmSaveFileAs
Variable type | Prefix |
---|---|
Integer | i |
Float | f |
Boolean | b |
Byte | bt |
Short | sh |
Long | l |
Single | sng |
Variant | v |
Pointer | ptr |
String | s |
Date | date |
Object | o |
Variable Type | Prefix |
---|---|
Static array | ar + type prefix |
Integer[] | ari |
Float[] | arf |
Boolean][] | arb |
Byte][] | arbt |
Short[] | arsh |
Long[] | arl |
Single[] | arsng |
Variant[] | arv |
String[] | ars |
Date[] | ardate |
Object[] | aro |
Collection | col |
Variable Type | Prefix |
---|---|
File | fi |
Process | proc |
Variable Type | Prefix |
---|---|
Form | frm |
TextBox | txtb |
TextArea | txta |
ListBox | lstb |
ComboBox | cbo |
Timer | tmr |
Button | but |
ToggleButton | tglbut |
ToolButton | tbut |