Hello!
NOTE: This is not the popular interface naming question about using or not using "I" at the beginning.
I encounter often the problem to name
an interface, which indicates a belonging or property of a class.
(Please see following list)
Let's brainstorm, what kinds of interfaces are there?
Indicate the "kind" of a class
DataStructure, Number, ThingIndicate the "profession" of a class
Comparator, Executor, ListenerIndicate a possible action performed with a class
Comparable, Executable, Closeable
The above are all clear to anyone, but let's get to my problem:
- Indicate a belonging or property of a class
HasListener, LinksToRoot, BelongsToParent, KnowsSibling, ContainsChildren, Named, WithDescription, ...?
So, the last point is my problem. My english is not perfect, but even I feel strange about such names. They sound to me less successfully chosen then other, less meaningful. But I often end up choosing right this kind of names.
It is even a greater discomfort in C# where interfaces are expected
to start with an 'I':
IHasListener, IKnowsSibling, ...
Sound to me like LOLSPEAK "I can haz a kitteh, tawtally being full of
cuteness, OMG!@#!"
So, how should I name an interface which indicates a belonging or property of a class?