Working on a simple todo app that allows the users to sort the tasks by hand. It's fairly simply to implement the model based on a LinkedList in Java.
Yet if I want to persist the sorted tasks in a relational database I would have to add a new column that provides an index by which I can sort the tasks.
The problem would be that every time a user changes the sorting (take for example that she puts the fourth task at the second position) I would have to update every task to fix the indexes in the database. That seems quite nasty to me. Is there a more elegant way to solve this problem?