File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "Naming method which returns boolean" Watch "Naming method which returns boolean" New topic

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()
nils appeldoorn

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 ...



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: 1044
Originally posted by Stan James:


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


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

I agree. Here's the link:
subject: Naming method which returns boolean
It's not a secret anymore!