Hi, everyone!
I would like to know wether there is a sort of gambas coding style guide?
I only found these resources in the official gambas wiki:
Any additional information would be appreciated!
Thanks in advance!
[SOLVED] Gambas Style Guide
[SOLVED] Gambas Style Guide
Last edited by zagirovaa on Thursday 15th July 2021 1:21pm, edited 1 time in total.
- cogier
- Site Admin
- Posts: 1118
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Gambas Style Guide
I have seen various opinions on this subject, but there is no law laid down saying you should do it 'this way'.
I use small letters in front of variables to donate the type. e.g. iCount for an integer, but I would use this for an array as well. Regrading form components, I can't see the point of changing Button1 to btnClear when all I have to do is change the '1' to 'Clear', so changing Button1 to ButtonClear is less work. Either of these is useful when you are coding in the IDE and you can't remember what you called that button, as soon as you type 'Button' Gambas will give you a list: -
This discussion could go on forever, so I suggest you pick out what suits you and get on creating that 'must have' application!
I use small letters in front of variables to donate the type. e.g. iCount for an integer, but I would use this for an array as well. Regrading form components, I can't see the point of changing Button1 to btnClear when all I have to do is change the '1' to 'Clear', so changing Button1 to ButtonClear is less work. Either of these is useful when you are coding in the IDE and you can't remember what you called that button, as soon as you type 'Button' Gambas will give you a list: -
This discussion could go on forever, so I suggest you pick out what suits you and get on creating that 'must have' application!
- BruceSteers
- Posts: 1521
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Gambas Style Guide
I'd agree, when it comes to style just go with what makes you comfortable.
I started helping with gambas development so that involved learning Benoits style. So my style has adapted somewhat.
Using iVar for Integer sVar for String etc makes sense and makes for more understandable code (6 months later when you've forgotton it) as does nice descriptive variable names.
there is a setting in gambas in your projects properties (options) to check your variable definitions for the i or s or whatever. (check prefix of variables)
but for the most part, if you plan on sharing your code , try to stick with popular styles. if not then do whatever
I started helping with gambas development so that involved learning Benoits style. So my style has adapted somewhat.
Using iVar for Integer sVar for String etc makes sense and makes for more understandable code (6 months later when you've forgotton it) as does nice descriptive variable names.
there is a setting in gambas in your projects properties (options) to check your variable definitions for the i or s or whatever. (check prefix of variables)
but for the most part, if you plan on sharing your code , try to stick with popular styles. if not then do whatever
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: Gambas Style Guide
Hi, guys!
I got it. Thanks for your replies!
I got it. Thanks for your replies!