[Gambas-user] Better use of prefixes

Jussi Lahtinen jussi.lahtinen at gmail.com
Sat Mar 16 22:13:55 CET 2019


I like short variable names and I find prefixes aesthetically more pleasing
than postfixes.
Thus I strongly prefer "btnThis" than "ThisButton". But both are fully
understandable.


Jussi




On Sat, Mar 16, 2019 at 10:53 PM Cedron Dawg <cedron at exede.net> wrote:

> Roger that.
>
> I don't generally use prefixes on Control Names, that's part of my (none)
> group.
>
> Didn't you mean?
>
> btnThat_click()
> btnThis_click()
> btnWhatever_click()
>
> I would use:
>
> ThatButton_Click()
> ThisButton_Click()
> WhateverButton_Click()
>
> for buttons on the form that say [That][This][Whatever]
>
> It's more linguistically (at least English style) consistent with natural
> language.
>
> Your sort order argument is valid though, but often enough don't you have
> a group of controls for a single purpose?  So you might have
>
> NameEntryTextBox
> NameEntryButton
> NameEntryStyleComboBox
>
> I am working on fairly large application now.  I am naming all the
> subroutines and controls with handlers a prefix for the tab they are on.
> That way all the routines group in the code routine list drop down.
>
> Again, the prefix has a where function to it.  Same style as I use for
> enumerated constants "XX_".
>
>
> ----- Original Message -----
> From: "gen braga" <genbraga1 at gmail.com>
> To: "user" <user at lists.gambas-basic.org>
> Sent: Saturday, March 16, 2019 4:00:42 PM
> Subject: Re: [Gambas-user] Better use of prefixes
>
> Cedron,
>
> I didnt mean a group handler... I mean all buttons grouped sequentialy in
> the IDE code editor's method selector combo box:
>
> btnButtonThat_click()
> btnButtonThis_click()
> btnButtonWhatever_click()
>
> Any reasonably intelligent person would need a minimun knowledge of Gambas
> or VB to understand group handlers anyway. Past the needed knowledge to
> understand prefixes.
>
> Cheers,
>
> Gen.
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190316/25628915/attachment-0001.html>


More information about the User mailing list