Suppose I have some objects, and I want the user to be able to reorder them in any way they wish, say, by dragging them around. So I'd have
- cheese
- muffins
- milk
and then the user drags 'milk' to the top, making the new order
- milk
- cheese
- muffins
Is there a best practice how to store the order of these objects in a database? The naive approach would probably be to just store a numerical value called "order" for each object, but this seems like too much hassle to me, because you'd have to shuffle the order-values around most of the time.