This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Naming method which returns boolean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Naming method which returns boolean" Watch "Naming method which returns boolean" New topic
Author

Naming method which returns boolean

Poobhathy Kannan
Ranch Hand

Joined: May 26, 2004
Posts: 94
I have a method which returns boolean .see bellow

public boolean getDigitalPhase()
{
return isDigitalPhase;
}

Which is a good naming for this method
1. getDigitalPhase()
2. isDigitalPhase()


http://learnertobeginner.blogspot.com/
nils appeldoorn
Greenhorn

Joined: May 09, 2005
Posts: 16
isDigitalPhase() should be the correct one, if you'd like to follow naming conventions
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
You'll see some other grammatical constructs from time to time ...

hasCooties();

canBoogieTillTheCowsComeHome();


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 988
    
    1
Originally posted by Stan James:

hasCooties();
canBoogieTillTheCowsComeHome();


...or just about any phrase using (singular) "present tense" verbs.

talksTooMuch()
makesTheBestOfABadSituation()

So getHeight() would return an int or float, but getsHeight() would "obviously" return boolean.

Ryan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Naming method which returns boolean
 
Similar Threads
JavaBean
fetch values from one package into another package
checkPermission without SecurityException?
How Do We Know that We Add Duplicate to a Set and Add Duplicate Key to a Map
Boolean