Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 389
Thomas Avatar asked Jul 12 '16 23:07

Thomas


People also ask

What is camel case rule?

CamelCase is a way to separate the words in a phrase by making the first letter of each word capitalized and not using spaces. It is commonly used in web URLs, programming and computer naming conventions.

Are camel cases standard?

But as object-oriented derivations of JavaScript, such as TypeScript, AngularJS and Node. JS, gained popularity, camel case has become the standard. Variable naming conventions, such as snake case or camel case, are standardized differently for each programming language.

What is camel case letters example?

the use of a capital letter to begin the second word in a compound name or phrase, when it is not separated from the first word by a space: Examples of camel case include "iPod" and "GaGa". See also.

What is camel case style?

CamelCase (or camelCase) is a style of writing in which the writer avoids using spaces between consecutive words. CamelCase is one of two ways that are frequently used in professional programming.


1 Answers

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.

like image 113
Mvarta Avatar answered Oct 17 '22 18:10

Mvarta