Re: Aesthetically pleasing identifier names
- Posted by Greg Haberek <ghaberek at gmail.com> Mar 04, 2005
- 539 views
> I used to use CamelCaps but now I've switched to foo_bar instead of FooBar for > most identifiers. However, it depends on the language I'm using as I try to keep > a similar naming convention to how the language tends to do it (although I can't > stand fooBar since I think it's stupid to leave the first character of a word > you'd normally capitalize lowercase even though you capitalize everything else, > Java does this). In Euphoria it's almost always foo_bar since all the standard > libraries use this method. For me, its not the language I'm using, but the platform (since Euphoria is cross-platform). For Windows, I tend to use Derek's Notation, even if I'm not using Win32Lib. Objects, such as control id's and control type constants, start with a capital letter and use CamelCaps style. Routines, however start with a lower case letter and the first letter of every word is capitalized. Of course even Derek strays from this from time to time... DN Prefixes: k - global constant v - global variable l - local variable (routine-level) p - parameter (routine-level) Printer, Screen - Objects setHandler(), getCtlSize() - Routines Again, this is only in Windows. For DOS and Linux, I still uses Robert Craig's Notation. This is a more simple (can I say that?) notation. Constants are expressed in all caps, and routines and variables are all lower case, with each word separated by an underscore. Library routines may be grouped by using the same prefix (db_) for database.e. TRUE, FALSE - constants get_vector(), db_fatal_id - routines, variables ~Greg