Page 1 of 1

[SOLVED] Gambas Style Guide

Posted: Friday 9th July 2021 7:00am
by zagirovaa
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!

Re: Gambas Style Guide

Posted: Friday 9th July 2021 1:59pm
by cogier
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: -

Image

This discussion could go on forever, so I suggest you pick out what suits you and get on creating that 'must have' application!

Re: Gambas Style Guide

Posted: Friday 9th July 2021 2:18pm
by BruceSteers
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 :)

Re: Gambas Style Guide

Posted: Thursday 15th July 2021 1:20pm
by zagirovaa
Hi, guys!
I got it. Thanks for your replies!