Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why "getEJBHome()" but not "getEjbHome()"!?

 
Nesan Krish
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a method in javax.ejb.EJBObject interface: "getEJBHome()". But if we follow the usual Java naming conventions this method should be named as "getEjbHome()"! Please explain why it has gone as "getEJBHome()". Thank you.
 
Sudhir V
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My best guess wud be that its just the JAVA team's decision. Kathy might get some insight into this coz she knows the team.
 
Harimohan Bawa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB is abbreviation and not just a regular word. (E)nterprise (J)ava (B)ean. I believe this is the reason you see EJB instead of Ejb.
 
Nesan Krish
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But, then why ejbCreate() method comes as "ejbCreate()" and not as "EJBCreate()"!!?
 
Mark Newton
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that the method ejbCreate() is not written as EJBCreate() because the first letter of all method calls should be a lowercase letter. This would produce eJBCreate() which looks odd so all of the letters from EJB are turned into lowercase to give ejbCreate().
The method used to join words together like this is referred to sometimes as camelcase, see below link for details. CamelCase
 
Harimohan Bawa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nesan Krish:
But, then why ejbCreate() method comes as "ejbCreate()" and not as "EJBCreate()"!!?

I believe it is not about looking odd. As I observed in Java Programs and used personally for method names, abbreviations either are all up or all down depending upon where they fit in method names.
In English grammar they may be all UP unless noted elsewhere.
ex: NATO is never used as a Nato , nATO.
WHO (World Health Organization) is not used as Who.

getEJBHome()
ejbCreate()
I hope it answers your question.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scott Ambler advocates for something different:
From IBM developerWorks: Java naming conventions:

Capitalize the first letter of standard acronyms
Names will often contain standard abbreviations, such as SQL for Standard Query Language. Names such as sqlDatabase for an attribute or SqlDatabase for a class are easier to read than sQLDatabase and SQLDatabase.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic