Talk:Naming convention (programming)
![]() | This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||
|
Deleted
[edit]I deleted, "Identifiers representing macros in C and C++ are, by convention, written using only upper case letters."
Because this is not true. "__cplusplus" for example is an all lower-case, standard macro. The all-caps macros are found primarily in Microsoft code, and have been adopted by some C++ programmers. C++ has very loose style guides; for the most part, everyone's is a little bit different.--RITZ 16:31, 10 October 2006 (UTC)
This use of uppercase (actually it no lowercase) for macro names predates the creation of Microsoft as a company. If you look at Table 787.5 of these measurements, second to last row, you will see that in general macro names do not include any lower case letters. Derek farn 16:44, 10 October 2006 (UTC)
The comment on Underscore being harder to access sounds pretty bull. On most keyboards, shift+- is the access key, and itM's certainly not that inaccessible (compared to ctrl+Shift or AltCar...)Circeus 18:55, 31 January 2006 (UTC)
The comment about programmers being lazy for typing long identifiers is subjetive. 11:31, 2 March 2006 (GMT -5)
- I agree, and have changed it to something more objective and sensible. In fact, the whole section needed revision. Claiming that most business applications are written in several languages, even if this was true, the multiple languages wouldn't interact with eachother, they would share data through a seperate medium such as the OS. --RITZ 16:41, 10 October 2006 (UTC)
- A caveat about "the multiple languages wouldn't interact with eachother[sic]"
- While multiple modules, written in multiple languages, tend to interact through OS/Network/data encode/decode, this doesn't completely eliminate the identifiers. For example, when JSON is used to encode a Node.js/Javascript structure, the naming convention is then baked into the JSON. This then "leaks" into any other reader/writer of these structures. It's not a huge interaction but it does happen.
- Also, depending on the OS bindings presented to each language, and the limitation on the C ABI, you can find C-identifiers created in Microsoft Windows libraries that are imported into C# programs. Drjasonharrison (talk) 17:09, 24 March 2022 (UTC)
C/C++
[edit]"In C, abbreviated names are the most common (e.g. isalnum
for a name of a function testing whether a character is alphanumeric), while C++ often uses an underscore as a word separator (e.g. out_of_range
). Template parameters are usually CamelCased."
I don't see why this was deleted as POV. It isn't about programming in C/C++ in general, only about the conventions used in the corresponding ISO standard documents, which are rather consistent and clear in this matter. Tigrisek 23:39, 7 September 2007 (UTC)
- The discussion reads as if it is about C/C++ in general (I think this would be the most appropriate subject to discuss; the conventions used in one document are is a somewhat specialised). You can read about some measurements of C naming usage in [1]. I am not aware of any measurements that back up the naming claims made about C++ and would not say that template parameters follow conventions that are any different from other names. Derek farn 12:33, 8 September 2007 (UTC)
- As to the template parameters – just take a look at the C++ Standard draft ([2]) or Dinkumware Standard Library reference ([3]). The guidelines are presented in the Boost C++ Libraries conventions guide ([4]). There is no normative document defining the conventions used in the Standard, which does not mean the Standard does not use any consistently. I think this information qualifies to be listed in the article on naming conventions (perhaps with emphasis on the fact that this applies to the language and its Standard Library, and not necessarily to habits used by many programmers).Tigrisek 12:38, 20 September 2007 (UTC)
Merging Programming style and Coding and Naming Conventions articles
[edit]Please see following talk page and provide me with some feedback if you like Talk:Coding_conventions#Refactoring_coding_conventions_and_programming_style_articles. Several bigger but straigtforward merges re. following articles are proposed: Programming style , Coding conventions , Naming convention (programming) . Thanks, Ptrb (talk) 12:45, 13 November 2010 (UTC).
Are variables constant in Java?
[edit]- Except for variables, all instance, class, and class constants are also in in "CamelCase", with the first letter lower case. ...
All constants except for variables?! Is this a thinko, or a quirk of Java? —Tamfang (talk) 22:15, 8 December 2010 (UTC)
- rewrote that section a bit , I think it is correct now. Ptrb (talk) 08:10, 9 December 2010 (UTC)
Variable naming convention in .NET
[edit]Microsoft did not mention anything about whether use Pascal or camal for variables (only parameters). It should be removed from the article. Jim Liu (talk) 06:50, 24 July 2011 (UTC)
Potential Benefits
[edit]- to enhance the aesthetic and professional appearance of work product (for example, by disallowing overly long names, comical or "cute" names, or abbreviations);
What evidence is there that disallowing comedic names is beneficial? I could see possible negative effects but I can also see the positives of having an informative and humorous identifier. Why is it polarized as negative? — Preceding unsigned comment added by 24.84.45.170 (talk) 07:31, 3 January 2013 (UTC)
- I can see your perspective, and at times a dry, "business like", communication style contrasts with a desire to enjoy one's work, there are too many negative possibilities for creating comical identifiers in a business environment. Sorry, not sorry. Too often, "Your joke is their insult."
- Most professional, that is business, writing tends to avoid ambiguous expressions as they lead to confusion on the part of the reader. What might seem funny to your current team could be seen as insulting to the customer or a new team member. Also if the ambiguity is in the realm of science/math/engineering then it potentially confuses the reader.
- My recommendation is to avoid the use of comical names, which require ambiguity and sharp shifts of interpretation, leave it in the comments, but please don't pollute the identifiers and your team perspective. Drjasonharrison (talk) 17:18, 24 March 2022 (UTC)
Classic C Naming
[edit]In the paragraph about C/C++ naming, the phrase "In the C standard library, abbreviated names are the most common" should be rewritten as "In the C standard library, abbreviated names are the most common and no underscores are used as word separators". Spartakrz (talk) 17:11, 24 October 2014 (UTC)
Page issues for uBlock
[edit]uBlock Origin defaults to cosmetically filter out the Composite word scheme (OF Language) section header for some reason, but I couldn't get it to allow variations of the section heading after it'd initially been blocked to display (such as removing words and the parentheses) without disabling cosmetic filtering. Maybe there's some accessibility inconsistency in the page that makes it do that? I haven't run into this on any other article I've viewed yet. Penitence (talk) 02:46, 12 January 2018 (UTC)
plus separated words
[edit]in section: Delimiter-separated words
please add 'plus separated words' aka 'google query case' aka 'html data case'.
refs:
https://stackoverflow.com/questions/2678551/when-to-encode-space-to-plus-or-20
https://www.google.com/search?q=url+escape+space+with+plus — Preceding unsigned comment added by Milahu (talk • contribs) 09:26, 11 December 2018 (UTC)
Stack Overflow is not a valid source
[edit]i do not think number 12 reference is a valid source — Preceding unsigned comment added by 210.55.72.157 (talk) 00:29, 27 August 2020 (UTC)
It
[edit]Self documenting language are referred to 103.171.46.27 (talk) 09:56, 27 June 2022 (UTC)
Dogma & scientific sources
[edit]The article states that different naming conventions are kind of a dogma. There is however a scientific litterature about the topic that allows to draw some conclusions, see for example https://makimo.com/blog/scientific-perspective-on-naming-in-programming/ which does a review, or single studies like https://www.researchgate.net/publication/4242245_Whats_in_a_Name_A_Study_of_Identifiers The article doesn't cite scientific studies. Its sources tend to be mostly conventions of particular languages, which are valid in the context of explaining one convention, but I think there's a lack of scientific sources or studies in the article itself. LDiCesare (talk) 06:48, 1 April 2024 (UTC)