Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Java by (2.6k points)

Most OO languages prefix their interface names with a capital I, why does Java not do this? What was the rationale for not following this convention?

To demonstrate what I mean, if I wanted to have a User interface and a User implementation I'd have two choices in Java:

        Class = User, Interface = UserInterface

        Class = UserImpl, Interface = User

Where in most languages:

    Class = User, Interface = IUser

Now, you might argue that you could always pick a most descriptive name for the user implementation and the problem goes away, but Java's pushing a POJO approach to things and most IOC containers use DynamicProxies extensively. These two things together mean that you'll have lots of interfaces with a single POJO implementation.

So, I guess my question boils down to: "Is it worth following the broader Interface naming convention especially in light of where Java Frameworks seem to be heading?

1 Answer

0 votes
by (46k points)

I favor not to practice a prefix on interfaces:

  • The prefix harms readability.
  • Using interfaces in patients is the usual most reliable way to program, so interface names should be as brief and comfortable as potential. Implementing classes should be more repellent to check their use.
  • When switching from an abstract class to an interface a coding convention with prefix I suggest renaming all the events of the class --- not great!

Related questions

0 votes
1 answer
asked Oct 17, 2019 in Java by Shubham (3.9k points)
0 votes
1 answer
asked Sep 26, 2019 in Java by Shubham (3.9k points)
0 votes
1 answer

Browse Categories

...