Search code examples
coding-stylecode-conversion

What is the prefix `I` before class name like IController, IObserver?


I'm learning MVP patter. In some examples, I saw this! Any one could demonstrate why programmers use this name convention?


Solution

  • Usually I is there to indicate an Interface. Without the I is it a class. Personally I am not a fan of this. I think it is more common in dot net. I havent seen it too much in Java

    Reasons why I dislike:

    • IDEs now show icons that indicate whether a class is an interface or not.
    • If I want to change the interface to an abstract class I then have to rename the class
    • It hurts readability.