I wonder which one is more suitable for a function name:
- isUHD
- isUhd
- (is4k)
I wonder which one is more suitable for a function name:
While UHD is written in all uppercase in English, Java naming conventions “win” in Java: They say we should use camel case, isUhd
.
It’s not that clear-cut, though. Even old JDK classes tend to keep all uppercase for abbreviations that are part of class or method names, for example Character.isISOControl
. Newer additions to JDK rather apply the naming conventions more strictly and use camel case, for example IsoChronology
(class in java.time.chrono
, since Java 8) or ZoneId.getAvailableZoneIds()
(where ID is written in all uppercase in English). Modern usage is camel case.
The comment by Krzysztof Atłasik supports the same. Google Java Style Guide is gaining recognition as the official Java conventions are not being maintained as the language evolves. Google is clear about camel case and gives this example among others: "supports IPv6 on iOS?" becomes supportsIpv6OnIos
.
Link: Google Java Style Guide