4

If a question has multiple pages of answers and the set of answers that span the page boundary have the same vote totals, when you click the next page button you might miss an answer as the random sorting order may move an answer that would have been on the succeeding page in the first ordering into a position that would now be on the preceding page.

For reference, please see this question: https://stackoverflow.com/questions/8440/visual-studio-optimizations. Notice that when you click the next page button, one (or perhaps both) answer(s) from the first page appears at the top of the second page. Presumably this slot(s) would have been filled with another answer(s) were we able to view what the page would have looked like in the previous ordering. To the user unaware of the feature, this answer(s) has been "lost." To others, it is merely painful to know if you have seen all the answers unless you refresh the page enough to be confident you've seen them all. This can be difficult if the number of answers is large (I tried to work out an algorithmic complexity bound based on probabilities for a way to be sure: I think it may be O(n2) views).

2
  • Veddy similah: meta.stackexchange.com/questions/18655/…
    – random
    Commented Aug 30, 2009 at 12:57
  • 1
    The underlying problem is undoubtedly the same, but the question isn't. I actually saw that in the list of possibilities, but it never occurred to me that the permalink had anything to do with sorting. Please leave this open.
    – tvanfosson
    Commented Aug 30, 2009 at 13:07

4 Answers 4

2

When there are more than (pagination limit) answers, the randomization sub-order is removed.

2

I would like to add my dislike for the randomness of the appearance of answers with the same number of votes. Twice now, I've come to Stack Overflow looking for an answer I know is in a question and I have to spend an extra minute or so looking for an answer.

A few examples:

  1. A few times I've come back to the same question to read an answer again, to ensure I understood it all or to grab a link, and due to the random sorting order, I was unable to scroll right to it. Instead I had to scan the whole page to find it.
  2. Today, I got an email from Stack Overflow saying there is another answer to my question. Great! I went there expecting to see it at the bottom of the page, when it didn't appear, I was confused. I then, remember the comments from the podcast, began to scan the page and find the new answer.

In conclusion, I find the new ordering scheme to be most irritating at a time-it-takes-to-find-something level and I firmly believe that the best productivity gains are in organizing your resources properly so that information can be found quickly and efficiently. At this point, I beginning to think I am working for the software, which raises a red flag.

1
  • If you want to see new answers to the question, you can click the Newest tab and sort to have the freshest pop to the top.
    – random
    Commented Sep 24, 2009 at 14:45
1

The simplest solution is to remove the randomness from the sorting algorithm. If you are doing sorting and paging, the sort algorithm needs to be deterministic. I run into the same problem when I sort things by date (less so with time, but only because the problem occurs with much less frequency). Whenever you do sorting on a column that can contain duplicates and you do paging, you need to always sort by both the actual sort column, then by some deterministic column (primary key) to ensure that you don't miss items on the page change. This would apply to the time-based sorting as well, but it's much more difficult -- depending on your resolution -- to get two items that occur at the exact same moment in time.

 var pagedAnswers = answers.OrderBy( a => a.Votes )
                           .ThenBy( a => a.LastUpdated )
                           .ThenBy( a => a.ID )
                           .Skip( (page - 1) * itemsPerPage )
                           .Take( itemsPerPage );   
1
  • Actually, if you have an index on the LastUpdated column, that may be enough since I think MSSQL will give them to you in index order even when there are ties.
    – tvanfosson
    Commented Aug 30, 2009 at 13:20
0

Oh geez, this random answer sorting just goes from bad to worse with this and the permalink thing. I think it takes the crown as the most ill-conceived feature added to SO.

1
  • +1. I agree. It is amazing most people seem to be against it and provide good reasoning for being against it, and they are not listened to.
    – GEOCHET
    Commented Aug 31, 2009 at 22:09

You must log in to answer this question.

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