6

While browsing some java-repositories I stumbled upon Class which had the Prefix I to their names.

For example i found the class IPlayer and i could not figgure out what this I shall mean.

PrimeAPI
  • 89
  • 4
  • 4
    Generally, I stands for [Interface](https://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html). Some developer prefix the names of interfaces with an uppercase I to underline that this type is an interface. – Turing85 Aug 09 '20 at 00:42
  • Probably interface. – Unmitigated Aug 09 '20 at 00:42
  • 2
    The problem is, it "could" stand for anything, however, many developers "tend" to use it when defining `interface`s, just like you sometime see `SomClassImpl` which tends to mean "the implementation of said interface" – MadProgrammer Aug 09 '20 at 00:44
  • 6
    It means that the person does not use the general Java conventions, which discourage repeating type information in the name. – chrylis -cautiouslyoptimistic- Aug 09 '20 at 00:51
  • 3
    Means too much exposure to Microsoft COM conventions :-) – user13784117 Aug 09 '20 at 01:05
  • 1
    Related: https://stackoverflow.com/questions/2814805/java-interfaces-implementation-naming-convention – Mark Rotteveel Aug 09 '20 at 09:26
  • Also see [Should interface names begin with an “I” prefix?](https://softwareengineering.stackexchange.com/questions/117348/should-interface-names-begin-with-an-i-prefix). – Zabuzard Aug 09 '20 at 09:27
  • More fatuous SO closure reasons, I see. How can the question "require more focus"? It is absolutely precise in what it is asking. I could agree it's not really a great question, but lack of focus is not the reason. – user13784117 Aug 09 '20 at 20:00
  • It implies the type is an Interface; however, it's actually not a Java convention; rather a C# one. – Giorgi Tsiklauri Jan 19 '22 at 21:27

2 Answers2

5

This is a naming convention some people use to name interfaces. IPlayer means interface for Player. I stands for Interface

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
0

This means that this class is an interface. It is a convention used for this identification.

  • Okay, thank you. Could have figured that out myself. – PrimeAPI Aug 09 '20 at 00:43
  • 4
    Personally, I don't think I'd call it a "standard", I'd be hesitant to call it a "convention" as, as far as I know (which isn't much), it's not documented anywhere and the core libraries don't tend to use it (but the core libraries don't always follow documented convention :P) - It is a "common practice" among "some" developers, but I don't think it's one that "everyone" is expected to follow ... just saying ;) – MadProgrammer Aug 09 '20 at 00:46
  • I thought about "convention", "common practice", but ended up wrongly writing "standard". In the end, that's right. – Higo Felipe Silva Pires Aug 09 '20 at 00:49
  • 1
    But it's not a convention in actual Java. Java has Collection, List, Map, Set, etc., and not one of them starts with "I", – user13784117 Aug 09 '20 at 19:57