Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The library that I'm working on has a parameter which defines priority of a certain process. I want the interface to be as clear as possible, but it seems that different people have opposite interpretations of priority values.

1. Lowest number has highest priority (1 - highest priority, 10 - lowest priority)
2. Highest number has highest priority (1 - lowest priority, 10 - highest priority)

Which way do you think is more natural/logical?

share|improve this question
For lots of fun you might consider using the negatives with 0 being 'average' priority. – jeffythedragonslayer May 19 '11 at 0:27
I think that for any task 3 priorities are enough. But to be on a safe side I'll make it 10. – Max May 19 '11 at 0:36
up vote 1 down vote accepted

There are good reasons for setting 1 (or 0) as the highest level of priority and using higher numbers for lower priorities.

First, the priority can represent the order that task(s) should be performed. Number 1 is the first task you do, hence it has higher priority that the second set of tasks you will perform.

Another is that the number of priority levels may be subject to change. In this case, how can you automatically determine what you should do first? If you let 1 represent the highest priority, then your code does not depend on the number of priority levels.

Doing a web search on the string "priority level numbering", many examples show up where the lower the priority number, the more important the task. Some examples use 0 as the highest, some use 1.

This is a long standing convention. Most processor priority level registers work the same way.

I know this does not seem intuitive, so you should make your ordering convention very clear when you work with numbering priority levels.

share|improve this answer
It's very intuitive to me. The problem is that to other people the opposite priority numbering is intuitive. – Max May 19 '11 at 9:30

Personally, I would never say "This is priority 1" and mean "This is the lowest priority possible". So logically, I would say 1 is a high priority and 10 is low.

However, if I could replace it with an enum, from WhyShouldICare to TheWorldIsCollapsing then I would. And in that case, oddly enough, I would expect the enumeration to run from WhyShouldICare at 1 to TheWorldIsCollapsing at 10.

share|improve this answer

Personally, I find a higher number = higher priority to be more intuitive. And it has the added benefit of extensibility: if you need to add something even higher priority later on, you can simply add an 11 to your scale and not need to change any existing values or go into negatives.

share|improve this answer
Sometimes you need to add something which has lower priority. – Max May 19 '11 at 0:23
+1 - but what if someone needs a new lower priority? I'm just voting for higher == higher, though the important thing is that (since it may not be obvious) it also needs clearly say that. – Steve314 May 19 '11 at 0:31
Another reasoning (opposite to highest number - highest priority) is when you imagine a line of people at a checkout counter. The first one in line has highest priority. – Max May 19 '11 at 0:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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