Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capitalization of an acronym that starts a parameter

I have a variable that indicates the length of time the UI can be idle. I have elected to call this variable UITimer. I want to pass the variable into my classes constructor and then store it off in a local field.

What is the proper way to do the casing of this? We use the common convention of a parameter not being capitalized. So should I do this:

uITimer

or this?

uiTimer

Also, we do an underscore and lowercase first letter for our fields.

Should that be declared like this:

 private int _uITimer

or like this

 private int _uiTimer?

I think _uiTimer is the way to go (the other option seems lame) but I am interested to see if I am missing something.

Best answer would be a link to a doc that says that acronyms should all keep the same case in C# naming (or something like it)

like image 591
Vaccano Avatar asked Jun 21 '10 18:06

Vaccano


People also ask

Should acronyms be capitalized?

Typically, acronyms and initialisms are written in all capital letters to distinguish them from ordinary words. (When fully spelled out, the words in acronyms and initialisms do not need to be capitalized unless they entail a proper noun.) An acronym is pronounced as a single word, rather than as a series of letters.

Do you capitalize the first word after an acronym?

That said, it is generally agreed that you should capitalize the first and last word of the title, along with any words of semantic significance—that is, nouns, pronouns, verbs, adjectives, and adverbs—along with proper nouns, proper adjectives, acronyms, and initialisms.

What is capitalization and abbreviation?

Although an abbreviation is composed of capital letters, the full words that define the abbreviation are not always capitalized. Each case involves considering if the word is an official name or a proper noun.


1 Answers

Microsoft's Framework Design Guidelines have the following to say on this topic:


3.1.2 Capitalizing acronyms

DO capitalize both characters of two-character acronyms, except the first word of a camel-cased identifier.

System.IO
public void StartIO(Stream ioStream)

DO capitalize only the first character of acronyms with three or more characters, except the first word of a camel-cased identifier.

System.Xml
public void ProcessHtmlTag(string htmlTag)

DO NOT capitalize any of the characters of any acronyms, whatever their length, at the beginning of a camel-cased identifier.


You've basically asked about the last of these three rules.

I personally would also opt for uiTimer, simply because uITimer looks less readable.

like image 108
stakx - no longer contributing Avatar answered Sep 30 '22 05:09

stakx - no longer contributing