In most languages I've used it's common practice to replace the reserved word class with clazz when you have a variable that refers to a class. This has become a sort of de facto convention, to the point where if I see klass it surprises me.

Is there any "replacement word" that's even close to as popular for the interface keyword?

  • 10
    what sort of terrible languages do you use where that is in any way a common practice?
    – Telastyn
    Oct 4, 2016 at 18:26
  • 4
    It's especially common in Java. Is this proof that Java is a terrible language? ;)
    – Dan1701
    Oct 4, 2016 at 18:29
  • 10
    I've worked with C#, C++, and Java for over 20 years now, and have never seen this.
    – Telastyn
    Oct 4, 2016 at 18:31
  • 7
    15 years of programming, and I have never once have I been so overwhelmed by the desire to use the word "class" or "interface" as a variable that I resorted to a bastardized version of the word. Your brain has a built in thesaurus. Use that instead.
    – riwalk
    Oct 4, 2016 at 19:16
  • 4
    @DarrenYoung: It would only make sense in a metaprogramming context, i.e. if you're manipulating class representations. It would never make sense in ordinary usage contexts. Oct 6, 2016 at 17:07

3 Answers 3



If we're talking about Java, it's very rare that you need to distinguish a Class object as being distinct from an interface. They're all basically types, and calling them all classes is reinforced by the fact that there is only a Class class (with an isInterface() method), and they are compiled to .class files. So I've seen clazz, cls, c ... clazz is pretty common.

If you did need to reference something knowing full well that it was an interface, and you wanted to convey that fact, then you'd have to invent your own name; it's pretty unusual, and you only get conventions for frequently-used concepts.

If I felt compelled to select a name, then why not intyMcInterface? - seeing as how Boaty McBoatface topped the famous Name This Boat poll. Or you could call it sirDavidAttenborough, like they ended up doing, but you might get some WTFs for that.


The reason that you see people trying to name a variable for this is that you can indeed get an instance of the reflective Class object for a given object. I don't know of any equivalent object that represents the reflected metadata of an interface.

I would probably still just use cls anyway.

And I won't even troll you by "seriously" suggesting you name the variable if for InterFace.


Using reserved words for variable names is bad form, but it can be done.

C# Example:

   string @interface = "Using reserved words for variable names is bad form.";

With this in mind. If you have to use a reserved word, try and think of something similar to use instead.


Or preface it with something specific:

  • NetworkInterface
  • DatabaseInterface
  • 1
    In C#, those would be INetwork and IDatabase Oct 4, 2016 at 20:15
  • @Robert - Thx, updated answer to be more interface specific.
    – Jon Raynor
    Oct 4, 2016 at 20:26
  • 2
    Actually, I misspoke; a variable of type INetwork would never have to be disambiguated, nor would you prefix the actual variable with I, only the type itself. Oct 4, 2016 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.