my dog learned polymorphism*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 1006
    
    3
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
 
Consider Paul's rocket mass heater.
 
subject: Naming method which returns boolean
 
Similar Threads
How Do We Know that We Add Duplicate to a Set and Add Duplicate Key to a Map
JavaBean
checkPermission without SecurityException?
fetch values from one package into another package
Boolean