A question that always teases me when I'm in a Java project in which we use terms in Portuguese is to deal with method names or variables that represent somehow two things and need to mention both in the method / variable name. In English, and in the same situation, the names get better.
An example, if I'm in an English code and I have a variable that contains the person's first and last name, I can have:
firstAndLastName
Simple and easy to read, thanks to And
. But in Portuguese our And
is E
, which is very bad to read in the code in my opinion, because the capital letters end up stuck:
primeiroESegundoNome
I do not know about you, but this part ES
gives me a hang on reading any code.
I usually end up using one of these alternatives:
primeiroSegundoNome
primeiroComSegundoNome
Resolve in some cases, it is only strange in others, but some do not solve. For example, if I have a method that checks whether the dates exist and are the same, wanting to emphasize this situation, none of the following forms serve well:
hasDatasIguais
hasDatasComIguais
isDatasExistemIguais
isDatasExistemComIguais
In terms of the name, it would look even better hasDatasEDatasIguais
, hasDatasESaoIguais
* ..., but we return to the initial problem.
Is this a problem that bothers you too? How do you act in similar cases?
* Here I mixed the English term has
with Portuguese, but this is another subject