File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Naming method which returns boolean

 
Poobhathy Kannan
Ranch Hand
Posts: 94
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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: 1048
4
  • 0
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic