3 ms·
That is clever, it's like a binary version of the old BASIC convention of numbering lines 10, 20, 30 etc, to leave space in case you want to add lines in betwee
by 6ren 15y ago
That is clever, it's like a binary version of the old BASIC convention of numbering lines 10, 20, 30 etc, to leave space in case you want to add lines in between.
But why number them at all - why not just use the order in the list as the ordering? I haven't studied their API, so there may be a good reason.
- gregschlom 15y agoBecause the 'order in the list' usually is the creation order of the items. If you want to change the tasks order, you need to save the position numbers in the database. This is not specific to Google tasks. If you tried to display a list of items that your users could reorder, you'd run into the same problem.
- 6ren 15y agoThanks. You could also recreate the list with the new ordering; or record the changes in list order and replay them on server (e.g. insert the 5th one after the 2nd one), perhaps even reducing it to the simplest change if the user played around with the order a lot. But I guess for RDB (and other DB?), the "physical" order isn't meant to be used as a "logical" order, and it might not even be reliable - so you need some other ordering mechanism, like position numbers. Also, not good if anything in the system depends on that physical ordering. \not a DB programmer