-2

Given that one needs to deal with case sensitive environment, when would one benefit from having all caps or all non-caps names of variables or similar identifiers, as opposed to have camel case? Limit being number of characters being enforced - max 6!

Normally one would not care about the case (machines would sort it by copy/paste mechanism), but every now and then, humans would need to deal with them directly.

I would rather see either all upper or lower case, for the fact of not need to remember the case in the first place.. and yes there might be a policy in place to manage this, but then again, is it worth to have that kind of policy at all!?

EDIT:

Thanks for the comments, but maybe I should clarify what I'm after exactly. I agree that naming convention should be adhered to, and I'm not trying to find excuses not to respect it. It is more like trying to change the policy and have some reasonable arguments for doing so.

This is not about programming language and I apologize if this is not the right place to discuss this - it seemed the right place to ask since I know software engineers deal with 'cases' on daily basis.

  • 10
    It makes sense to always use camel-case when your coding standard says to use camelCase. It does not make sense to NOT use camelCase simply because the name is small. It is hard enough to get people to follow the coding standard and learn all the rules without adding a bunch of exceptions to the rules as you want to do. If you don't want to use camelCase for small names then don't use camelCase for any sized names. At least you'd be consistent. – Dunk Oct 03 '17 at 20:11
  • 2
    Please try to stick to the conventions in your programming language. There are usually dominant conventions. – Frank Hileman Oct 03 '17 at 23:26
  • I think part of the reason this question is getting such a poor reception is that it doesn't make the context very clear. – candied_orange Oct 04 '17 at 20:32
  • @Hinko - are you suggesting identifiers should only be 6 characters? – JacquesB Oct 05 '17 at 07:13

1 Answers1

12

The point of camelCase or PascalCase is to help humans parse a string of letters into separate words. This can turn out to be important as experts-exchange.com found out the hard way. ExpertsExchange.com brings to mind a very different site than ExpertSexChange.com.

If you were talking about setting a coding standard I'd point you to other successful standards in your language, but a 6 character limit makes me wonder if those even exist.

The real question then is, do you have multiple words for humans to parse in these 6 characters? I've dealt with systems that had a similar scheme, though ours was 8 characters. We did ours in all caps. Conceptually it was 2 four character "words" mashed together. Human parsing wasn't an issue because it was always 4 and 4. Here the "policy" made this a non issue.

You'll need to look into what values will be represented with these 6 characters before anyone will be able to say if sticking with all caps or otherwise is the best but my impression is that it's hard to cram two words into 6 characters.

candied_orange
  • 102,279
  • 24
  • 197
  • 315
  • I'm not asking this in relation to any programming language. Name of 6 characters would contain: a) an acronym of couple of words or b) short version of a single long word. I can tell that camelCase looks better for b), but it might be harder for humans to type it without knowing what it means.. Imagine you know what to type but you are not sure what case to use with each character. Single case names make this a non-issue. – Hinko Kocevar Oct 04 '17 at 07:33
  • @HinkoKocevar With good tooling, not knowing remembering the case should not be an issue anyway. Moreover, if an identifier is shortened and camelCased, I have it broken into groups in my mind, which (anecdotally) makes it easier to recognize the link when the concept is referenced in documentation. –  Oct 04 '17 at 12:08
  • Bear in mind that in a lot of languages the convention is to use all caps for things like constants or macros, so using all-caps for things that are not constants or macros is just going to be confusing and misleading. – Sean Burton Oct 04 '17 at 14:25