Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am using a voting module, that allows you vote either up or down [or reset].
If you vote up, the value is +1.
If you vote down, the value is -1.
If you vote up then down, the value is -1.

I want to extend this module to allow you to vote multiple times, and the votes to be incremental.

Examples

Up, Up = +1, +1 = +2
Up, Up, Down = +1, +1, -1 = +1

I want to create a new boolean variable. If FALSE/NULL then use the old system +1/-1. If TRUE, voting will be incremental.

What should be the name of this variable be? I feel 'incremental' is not the correct name. This module is part of an open-source project and is used on 3,177+ websites, so I want to get the naming convention right.

Naturally, I'll be setting an upper and lower limit the variable be. [ie 5 & 0]

Side-question: Is there a mathematics term to describe something being either +1/-1?

share|improve this question
mathematics term to describe something being either +1/-1 would be most likely sign – gnat Dec 19 '12 at 17:54
Well, there is a value that needs to be adjusted. Or updated. Rubberized. Whipped out. Greased down. – ott-- Dec 19 '12 at 18:28

closed as not constructive by Oded, Walter, ElYusubov, gnat, Dynamic Dec 19 '12 at 20:35

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

3 Answers

Normally I agree with what SomeKittens said, but since this sounds more like a configuration variable than a tracking variable, I'd suggest an allow or use prefix.

allowMultipleVotes
allowIncrementalVotes
useMultipleVoting
useIncrementalVoting
...
share|improve this answer
1  
Maybe allowVoteSumming or useValueForVotes too to indicate what you are doing with the votes – Drake Clarris Dec 19 '12 at 19:19

For most "tracking" boolean variables, I like to prepend is. In this case, the variable would be named isIncremental. This makes it very easy to see what you're doing in code, i.e.:

if(isIncremental) {
    //dostuff
}
share|improve this answer

Call it a vote. It's not simply incrementation as it goes up and down and it's not a sum as it has odd behavior with the how upvotes and downvotes interact.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.