Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
I'm working on a project in Perl that would need to have certain items ordered according to user preference (similar to nodelets here.) My initial thought was in remeberance of the days of qbasic--numbering lines in increments of ten and if something was to be added between 20 and 30, I'd add a 25 between them. This obviously has the downfall in that if you messed with your code enough, it would always eventually need to be renumbered.
So I scratched that idea. Even if I used reals, it still would not be as clean as I would like. It would be possible to renumber all elements when the user chose to modify one, but that would be terribly inefficient when the number of total number of elements increased. My second idea would be to set a cron to run at 2AM (or the slowest time of activity for the server) and renumber _all_ elements for _all_ users to keep things clean. (The numbers integral.)
Needless to say, I'm not too happy with any of these ideas. There has got to be a more efficient way! Anyone have any insight onto this topic?