Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Naming method which returns boolean

 
Poobhathy Kannan
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()
 
nils appeldoorn
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
isDigitalPhase() should be the correct one, if you'd like to follow naming conventions
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll see some other grammatical constructs from time to time ...

hasCooties();

canBoogieTillTheCowsComeHome();
 
Ryan McGuire
Ranch Hand
Posts: 1078
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic