I want to create an interface for "Items". Typicaly I would name an interface by adding and "I" prefix to a base word. But in this case my base word already starts with an I. Here are a couple ideas I've had
What looks the best? Has anyone else run into this problem. If so what did you do?
Interface names should be capitalized like class names. Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized. Except for variables, all instance, class, and class constants are in mixed case with a lowercase first letter.
There are two main naming conventions for interfaces in Java: no prefix or suffix for interfaces, ~Impl suffix for implementations, ~I prefix for interfaces.
The "I" in front of interfaces is another backwards convention. When you are passed a reference to an object, you should expect it to be an interface. Interfaces should be the default; so there is no point in doing something extra, like using an I prefix, to announce that you are doing what everyone expects you to do.
The name of the interface should describe the abstract concept the interface represents. Any implementation class should have some sort of specific traits that can be used to give it a more specific name.
Although hard to read, IItem
would be in line with some existing "II
" interfaces:
Simply IItem
. There is no need for an exception.
Interfaces start with two upper case letters (I[A-Z]), which identify them as an interface. So Item
is not an interface, but IItem
is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With