Talk:CamelCase

From Wikiversity
Latest comment: 9 years ago by Dave Braunschweig in topic Capitalisation
Jump to navigation Jump to search

The technique discussed on this page is actually the CamelCase naming convention, see: [1] Hungarian Notation means giving variables a name that reflects their type, such as beginning all string variables' name with the 's' prefix, such as sUserName, sPassword; while prefixing all integers with another prefix, for example i, such as iAge and iWeight. However, this topic should be seriously extended and re-written, with a title of something like "general coding style guidelines", providing some language independent (rather difficult task) or language dependent coding advices regarding capitalization, naming conventions, whitespace conventions (such as usage of space around operators and identing), etc. Giving general guidelines concerning this topic is rather difficult, as programming in C# tends to be rather different than programming in say... Pascal, but some universal guidelines can be provided. (As a software engineer student I'm rather surprised that nothing like this is included in the curriculum around here, thus reading each other's code sometimes proves to be a rather demanding task, even within the bounds of programmers from the same university.) 194.39.218.10 14:29, 10 June 2009 (UTC) Attila BertókReply


1) The statement:

The first word in a Hungarian notation sentence is already clearly marked out as the first word which means that you do not have to capitalize it.

...Makes little sense to me. Charles Simonyi suggests that the capital initial belongs to the "qualifier", and the first word, the "type", is lower-case. 2) There is no discussion of combining type prefixes. 3) A table of Hungarian Notation as used in Microsoft Windows would be *very* helpful. Madman420 10:54, 11 August 2009 (UTC)Reply

While it is important to know what CamelCase and Hungarian Notation are, please note that CamelCase and Hungarian Notation are NOT in use everywhere, as implied by this article, and are even frowned upon in some professional circles. Examples include many C programmers in the UNIX and Linux tradition. The argument for CamelCase is that it requires less keystrokes to type something like "ClearAllVariables" than "clear_all_variables", However, the latter is much easier and faster for the brain to parse because the words are clearly separated. This is compounded because some lower case letters are tall (l, t, etc) and can't be, at a glance, determined if they are uppercase letters or part of another word until the brain actually processes the letter itself.

Hungarian notation not only suffers from this, but also (in my opinion) unnecessarily elongates variable names with type information. Type information shouldn't be conflated with variable information: if you change a variable's type, you now have to go through and change all the references to the variable into the new name. It also leads to hard-to-read variables whose meaning can be lost in a sea of type information (ie, "ptrByteIter" versus "iter"). Finally, the main reason given for HN is that a programmer can tell exactly what the type of a variable without looking at the variable declaration. This, however, assumes that functions are complex, with too many variables, or variables that have names that don't relate to their use. If that's the case, a much better option is to break the function into a collection of simpler functions: not to add type information to the variables. See the linux and solaris kernel coding style documents for more examples.

Good article, just wanted to point out that not everyone uses HN or CamelCase. 173.64.113.92 03:02, 21 October 2010 (UTC)Reply

Hungarian notation is not the same as CamelCase[edit source]

As noted before, Hungarian notation is not the same as CamelCase, but rather a variable naming convention using the type as a prefix. Hungarian notation should not point to the CamelCase article. Wmsigler (talk) 18:39, 3 July 2012 (UTC)Reply

Capitalisation[edit source]

Why does the article refer to "CamelCase"? Would it not be better to refer to "camelCase"? If that's not possible, how about "Camel Case" as two words? 77.73.168.99 (discuss)

It is possible to lowercase the first character of an article title using DISPLAYTITLE. However, in general we follow Wikipedia's lead in terms of how things are named. See Wikipedia:CamelCase. -- Dave Braunschweig (discusscontribs) 13:48, 3 July 2014 (UTC)Reply