Skip to content

How to name interfaces in Java (and to some degree other languages)

I’ve always wondered (and debated) about how to name interfaces and abstract classes, and this discussion here is pretty insightful:

Since the Plone days, I’m used to interfaces that starts with an I, but the discussion highlights some very good points against this:

  • Interfaces define functionality in the form of a contract, their names should not reflect their type (interface), but rather should focus on the functions they enforce
  • Interface names should be short, easy to read, and as basic to its function as possible. On this note, it should also be as generic as possible, (i.e. the name should stay away from words that hints at possible implementation details)
  • There are times when Interfaces gets changed into Abstract classes, and the I prefix is annoying to deal with


Posted in Java. Tagged with , , .