Alex Rivera | Logout

What is correct Java naming convention for id?

Asked 2009-11-09T09:22:18.547
25

If I have user id variable, what is correct java naming convention for it?

userId or userID

Edit
Report

1 Answer

40

I think I read somewhere that the best guideline is to always capitalize only the first letter of an acronym (i.e., if you have a user TTL where TTL is some random acronym in your project, then it's best to write userTtl).

This makes sense, since it solves some problems. For example, say you want a user id counter. Readability of userIDCounter is worse than userIdCounter. For a longer acronym, it gets even worse.

answered 2009-11-09T09:26:00.587

Your Answer