I often see code that include intentional misspellings of common words that for better or worse have become reserved words:
klass
orclazz
for class:Class clazz = ThisClass.class
kount
for count in SQL:count(*) AS kount
Personally I find this decreases readability. In my own practice I haven't found too many cases where a better name couldn't have been used — itemClass
or recordTotal
.
An example from the JavaDocs for Class show this in the parameters:
public <U> Class<? extends U> asSubclass(Class<U> clazz)
Does this show a reasonable use case?
Best Answer
IMHO, this is a very bad idea. Reserved words are reserved for a reason, and doing this does decrease readability.
I also entirely agree with your second point. Naming a variable
class
, even if you could do it, would be just as bad as naming ittmp
ora
. What kind of class? A class of what? Names should be descriptive.