[SOLVED] Gambas Style Guide

Post your Gambas programming questions here.
Post Reply
User avatar
zagirovaa
Posts: 8
Joined: Tuesday 27th September 2016 5:48am

[SOLVED] Gambas Style Guide

Post 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!
Last edited by zagirovaa on Thursday 15th July 2021 1:21pm, edited 1 time in total.
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Gambas Style Guide

Post 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!
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gambas Style Guide

Post 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 :)
If at first you don't succeed , try doing something differently.
BruceS
User avatar
zagirovaa
Posts: 8
Joined: Tuesday 27th September 2016 5:48am

Re: Gambas Style Guide

Post by zagirovaa »

Hi, guys!
I got it. Thanks for your replies!
Post Reply