Jump to content

Sorting should be stable


dante2428

Recommended Posts

When clicking the list headers to sort the torrents/files/peers/etc. by some criteria, I expected the sort to be stable (i.e. the relative order of records with equal keys/values to be kept). But this is not currently the case.

E.g. if I want to sort all the files in a torrent by Priority, with all the files having the same priority sorted descending by the completion percentage, two (or one, for ascending) clicks on the "%" header then one click on the "Priority" header should do it.

Right now this multiple-criteria sorting is not possible, because sorting is not stable.

Link to comment
Share on other sites

I think you're confusing something here. The problem isn't a matter of stable vs non-stable sort, as µTorrent's sorts are relatively stable -- it already seems to use other data fields as tie breakers internally. The problem is a question of how to tell µTorrent to use a different secondary sort criterion, and that can be done by holding Shift while clicking on the target secondary column.

If a keyboard modifier weren't used, then every subsequent column header click would add a n-ary sort criterion to the sorting process -- how otherwise would µTorrent know when the user meant to sort primarily on a column, or sort secondarily on the clicked column?

Link to comment
Share on other sites

Thanks, that Shift+Click was what I wanted. I didn't know about this, now I see it's implemented exactly so in Windows Explorer and Total Commander (which also supports Ctrl+Click for more than 2 sort criteria). Let me just say that its discoverability is almost nil.

If µTorrent's sorts are stable (there is no relativity to the sort stability, as I understand it), then indeed something else is being used as tie breaker (I suspect the File Order, for the Files list).

Regarding your question: in my (counterfactual) interpretation, the order of the clicks would set the (reverse) order of the criterions: a click on column A would sort on A, then a click on column B would mean a sort primarily on B, and for equal values, a sort on A (the previous criterion); another click on column B would mean reverse sort on B, then solve ties based on A; another click on C would mean sort on C, then for ties reverse sort on B, then for ties sort on A, etc. All this would be just a side-effect of the sort procedure being stable, no extra coding necessary for handling multiple criteria.

Although I still regard this behavior as intuitive (at least more so than the SHIFT+ method), now I can't find any apps that use it.

Thank you again.

Link to comment
Share on other sites

Indeed, I haven't seen any application behave in that way in forever, and the only time I'd ever seen that was when the listview was statically sorted -- not dynamically sorted as µTorrent's listviews are. That said, I do agree with that expectation, and in retrospect, it's similar to (if not exactly) something that I once pondered about years ago (of course, not to any exact degree as you've described), but never really bothered to push for.

I also agree that Shift+Click is horrible from a usability/discoverability standpoint.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...