20

I'm trying to group together an object's vertex X components in a vector, like structure of array style.

Naturally this is the way.

Vec xComponents; or Vec xVals; or simply Vec x;

However sometimes I want to specify in the id what x components belong to, I think about doing this.

Vec objXComponents;

However, the two capitals next to each other seem to break a rule about camel case, and may make it slightly less readable.

What should I do for this case? I know you may say just cull the components post-fix and use objX, and while I think that's OK for this case I would like a general solution / standard.

I tried finding if microsoft has a standard for this but I cant find it on their style guidlines.

Thomas
  • 6,032
  • 6
  • 41
  • 79
  • 3
    I always try to put the single letter at the end, like ValX, or ComponentX. It looks better to me, and sorting of member variables will likely do something more useful than putting the single letter at the beginning. – Anon Coward Jul 13 '16 at 00:38
  • See: https://msdn.microsoft.com/en-us/library/ms229043.aspx – Blorgbeard Jul 13 '16 at 02:28
  • 1
    Also, c.f. `IEnumerable`, `XDocument` in the .NET framework. – Blorgbeard Jul 13 '16 at 02:28

1 Answers1

20
objXComponents

seems appropriate.

Why? The "formula" for camel case seems to be as follows:

1- First word in the identifier is all lowercase

2- First letter of the words that follow are uppercase

3- Remaining letters of words that follow are lowercase

If the word is one letter, then that letter is first, so uppercase it.

Mvarta
  • 518
  • 3
  • 7