7

I don't understand the difference between ascending and descending? Surely ascending means the most active/recent/popular/A first, and descending means the least active/recent/popular/Z first?

But it seems it's the reverse in most API routes. (I think there are a few where it's different but I always find it hard to get my head around asc vs desc)

EG: http://api.stackoverflow.com/1.1/tags?order=desc&sort=name brings up results that start with Z

but: when using descending with date/activity sorted routes the most recent/active items are shown.

1
  • +1 I never noticed this either. Tagging as a bug. Mar 20 '11 at 19:42
15

Dates increase as time advances, so 1293861600 (Jan. 1st 2011) is greater than 946706400 (Jan 1st. 2000). Thus, a descending ordering puts the most recent dates first.

Because sorting by dates is much more common than by name, ordering is descending by default.

5
  • Surely ascending means, as you go up the list the value gets greater? It doesn't say this in /usage
    – Jonathan.
    Mar 21 '11 at 7:33
  • @Jonathan - that is what ascending means, and that's why the most recent dates are returned first in when order=desc; since they are larger than dates in the past. Mar 21 '11 at 15:49
  • ok I've just never understood ascending and descending I find they are uselessly indiscriptive and kind of generic. I'll just have to take 15 minutes to learn them.
    – Jonathan.
    Mar 21 '11 at 15:57
  • I know I'm late, but I'll point out for the alphabet: think of it in ASCII (Unicode) numbering. Z is highest in number, while A is lowest in number. So a descending alphabet starts at Z and ends at A.
    – Adam Dunn
    Mar 24 '14 at 19:02
  • 1
    @Jonathan. I know this explanation sounds a bit 'Peter & Jane', but the way I visualise this, is: I am at the bottom of the stairs. The first stair is stair number 1 and the second stair is stair number 2 etc. As I "ascend", the stair number increases, so I am going from the lowest numbered to the highest numbered stair. And dates are actually just numbers [seconds actually from 1970]. So with date order=asc, means that you see the least recent [lowest number] dates first & date order=desc, means that you see the most recent [highest number] dates first! Oct 29 '17 at 16:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .