Thomas
Thomas

Reputation: 6196

Single letter words in camelCase, what is a standard for handling these?

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.

Upvotes: 22

Views: 9615

Answers (1)

Mvarta
Mvarta

Reputation: 548

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.

Upvotes: 23

Related Questions