• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But, then why ejbCreate() method comes as "ejbCreate()" and not as "EJBCreate()"!!?
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
What could go wrong in a swell place like "The Evil Eye"? Or with this tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic