lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I think coding the type into the name is a bad idea and always have
been. I always hated microsoft code that heavily used hungarian
notation:

http://en.wikipedia.org/wiki/Hungarian_notation

Even in a static typed language this is IMHO nonsense, in a dynamic
typed like lua even more so. Just keep the variable name to a
signifier without coding anything more into it.

On Thu, Oct 13, 2011 at 3:29 AM, Patrick Mc(avery
<patrick@spellingbeewinnars.org> wrote:
> I am planning on changing my business name for the 6th time. In a project I
> did a while back, I used X as a separator and wrote code like this,
> someXstupidXvar, I'm really bad at naming things!
>
> In my next project I will be heavily using the Lua C API. I like their
> naming conventions but I want my code to be easy to spot amongst theirs.
>
> I figure that most non-trivial names have a commonly used part and one or
> more uncommon parts.
>
> I was thinking of truncating the common part at 3 or 4 characters and
> capitalizing it, even if it did not sample the syllables of the full name.
> So STA instead of STK for stack or ARR instead of ARY for array.  I was then
> thinking of separating with an underscore and then using lowercase and a
> non-abbreviated name(s) for the less common parts.
>
> so here are some fictitious examples
>
> ARR_pop
> ARR_rotate_left
> STR_concatenate
> STR_copy
> NUM_to_hex
> NUM_double
>
> Does this sound logical? Any pitfalls I am setting myself up for? Is this
> more of my naming insanity?
>
> Thanks for reading-Patrick
>
>
>