sorting ascending vs descending

  • 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 I never noticed this either. Tagging as a bug.

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

    Surely ascending means, as you go up the list the value gets greater? It doesn't say this in /usage

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

    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.

    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.

    @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!

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM