Coding Style – How to Camel-Case Consecutive Words with Numbers

coding-stylenaming

Just wondering if anybody has a good convention to follow in this corner-corner-corner case. I really use Java but figured the C# folks might have some good insight too.

Say I am trying to name a class where two consecutive words in the class name are numeric (note that the same question could asked about identifier names). Can't get a great example, but think of something like "IEEE 802 16 bit value".

Combining consecutive acronyms is doable if you accept classnames such as HttpUrlConnection. But it seriously makes me throw up a little to think of naming the class IEEE80216BitValue. If I had to pick, I'd say that's even worse than IEEE802_16BitValue which looks like a bad mistake. For small numbers, I'd consider IEEE802SixteenBitValue but that doesn't scale that well.

Anyone out there have a convention? Seems like Microsoft's naming guidelines are the only ones that describe acronym naming in enough detail to get the job done, but nobody has addressed numbers in classnames.

Best Answer

I'd figure out a new variable name instead of trying to figure out what naming convention to use for a double-number variable

That said, if I absolutely HAD to use a double-number in my variable name, and I couldn't rearrange the words/numbers to come up with something reasonable, and absolutely no other name would make sense, I would use an _ between the numbers

...

Actually I take it back, I would just figure out a new variable name :)

Related Topic