Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Naming convention

 
Volker Abel
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello out there

a question about naming interfaces: I personally prefer to name interfaces with a "I" as first letter, e.g. IService, IDatabaseAccess, ... so you can see by its name that something is an interface.

Sun coding conventions seem neither to forbid nor to encourage that either saying only "Interface names should be capitalized like class names.", but their examples do not have an "I" (RasterDelegate, Storing).

How do you think about this?

Regards,
Volker.

P.S.: I tried to search the forum for similar topics, but the search mechanisms seem not to be capable for this kind of search.
 
Roberto Perillo
Bartender
Posts: 2273
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, partner. I thought a lot about this, but I decided not to put an I in front of interfaces' names, because the interfaces that come with the Java language do not have it. For instance, there's no IActionListener, IRequestDispatcher or IHttpSession. But I think that if you decide to do so, it shouldn't be a problem.
 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Having an "I" in front of interfaces may be nice but as Rob said the API doesn't follow that. For the assignment Sun's provided interface is called DBMain for me anyway. So for interfaces, I start mine as DBxxxx such as DBRemote for my remote interface.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!