How does Camelcase work? Where do I use upper and lower case names?

Asked

Viewed 1,259 times

1

I didn’t quite understand the concept of naming with uppercase and minuscule letters.

I know which classes should be named with the first capital letters (Camelcase), but and objects, variables, and other identifiers?

1 answer

1

This is just a naming convention, not necessarily followed, at least in Java and most languages. Some take it so seriously that they don’t have to, that they themselves don’t maintain a pattern. Java even misses a few things, although more rare.

This is important for the person not having to think too much when writing code and always keep it that way, while helping the reading since the written form already gives a better visual indication of what it is.

Class, instance or local methods and variables must be pascalCase. It is recommended not to use _ even if you can.

Has a guide I responded well complete to C#, which helps to think about a lot of things. Of course Java follows slightly different patterns. You have to like one or the other. There are those who curse the fact that constants and enumerations in Java are ALL_CAPS or methods are pascalCase, there are those who think that only this way is good.

The important thing is to adopt and follow a standard and follow. Ugly, inconsistent code is hard to read. If adopting the standard language helps also who is not used to your code read.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.