[Gambas-user] Better use of prefixes

Gianluigi bagonergi at gmail.com
Sat Mar 16 18:25:08 CET 2019


http://gambaswiki.org/wiki/doc/namingconvention?ht=prefix
http://gambaswiki.org/wiki/doc/naming
I try to follow these conventions and I'm happy if others do, so the code
is more readable.

Regards
Gianluigi

Il giorno sab 16 mar 2019 alle ore 17:54 Cedron Dawg <cedron at exede.net> ha
scritto:

> As I said in my previous reply, Hungarian isn't as beneficial as it is
> touted.  What is more important when looking at code is knowing where the
> variable is defined and thus its scope.
>
> That's what I use prefixes for.  Here is my current set:
>
> =========
> Property/Variable Prefixes
> ---------
> (none1)     Simple local variables, e.g. i, x, N, etc.
> (none2)     Gambas Property Declaration
> (none3)     Subroutine Names
>
> the         Within a Sub
>
> My          Public - Within a Class
> my (or $my) Private Property/Variable
>
> Arg         Argument in Public Routine
> arg         Argument in Private Routine
>
> Ret         Updatable Argument in Public Routine
> ret         Updatable Argument in Private Routine
>
> Our         Static Public Property/Variable
> our ($our)  Static Private Property/Variable
> =========
>
> The only one you guys use is "$", so I included it for kicks though it is
> redundant with my and thus qualifies as an uglifier.  Though its utility is
> unquestionable.  Now expand that to this set.
>
> This prefixing system is way way way more useful than Hungarian.
>
> Combine with good suffixing indicating the kind of variable which
> generally implies the type:
>
> e.g.  myPostCount
>
> my = private class variable
>
> Post = the actual thing
>
> Count = "Count of" implying integer
>
> e.g. myPostIndex
>
> e.g. MyLastName
>
> The additional benefit of this system is that it avoids almost all name
> collisions with system names and makes global search and replaces a lot
> less error prone.
>
> ----[ 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/019dfe90/attachment.html>


More information about the User mailing list