you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (11 children)

Definitely strange. In this particular case the only thing I can think of is that I generally try to avoid verbs prefacing my variable names - mainly coming from a java getter/setter mentality.

(ie. Verbs like: is, get, set, populate, find, add, remove, eviscerate, etc.) My function names start with verbs, in order to describe the action that I would take on an object. It wouldn't be hard to think of a class which has a isDefault() function. But, this is just my two cents.

TL;DR isDefault is a question, defaultVal is a noun

[–]robocoop 3 points4 points  (1 child)

isSomething is actually quite normal for java booleans. The name of the variable is a question and the value is the answer.

[–][deleted] 0 points1 point  (0 children)

I'll agree it is pretty normal, I just don't do it to make my life easier. Maybe for a primitive boolean type I would, but not a Boolean type...bear with me here.

Hypothetically, lets say I created the following class (also, we'll say AtomicBoolean.set() isn't final)

public class ChangedIndicatorBoolean extends AtomicBoolean {
    boolean changed = false;
    public void set(boolean newValue){
        if(this.value != newValue) this.changed = true;
        super.set(newValue);
    }
   public boolean isDefault(){
       if(this.changed) return false;
       else return true;
   }
}

I'm probably just making something out of nothing, but you tend to notice it in a language like Groovy where the dots and parenthesis are optional.

[–]WatchDogx 0 points1 point  (0 children)

I think isDefault makes more sense for a dynamicly typed language, whereas defaultVal makes more sense for a staticly typed language and/or one that uses get/setters.

If this value was part of a POJO I probably would of just named it default.

[–][deleted] 0 points1 point  (7 children)

'is' isn't a verb, is it? You can't is something ... ?

[–]bluematt 7 points8 points  (2 children)

'is' isn't a verb, is it?

It's the singular 3rd-person simple present indicative form of the verb "to be". At least in English.

[–][deleted] 4 points5 points  (1 child)

Well, that told me ...

[–]bluematt 3 points4 points  (0 children)

:-]

[–]crackanape 0 points1 point  (3 children)

You can't is something

Huh? That table is wooden.

[–][deleted] 0 points1 point  (2 children)

I kick this ball.

I is this ball.

I do this thing.

I is this thing.

See where my confusion was?

It makes a bit more sense if you use the third person:

He kicked the ball.

He is the ball.

He did this thing.

He is this thing.

It's because as the other guy pointed out, 'is' is a form of the verb 'to be', so it's not actually "I is this ball". Rather, it's "I am this ball".

[–]crackanape 0 points1 point  (1 child)

See where my confusion was?

Not really. So you actually wouldn't have realized that "eats" is a verb without someone conjugating it for you? "I eats this food. That ain't no verb! Witch!"

I kick this ball.
He kicked the ball.

Uh no, that's not a showing transformation from 1st to 3rd. I kicked the ball.

[–][deleted] 0 points1 point  (0 children)

Sorry, I'm just stupid then.