2

By index, I mean, as the user creates the list, each item receives an integer index for its place in that particular list. Since there will be a table of ListItems, I'd prefer to avoid using the name "Index" for the field.

Then I was thinking - should I even include the list index in the database? I figured I would because the list would be created in the same fashion every time, then. Or I could order the list for the user based on its actual primary key, since the list items are created in succession anyway...

What should I do?

asked Oct 21, 2013 at 17:13

2 Answers 2

3

Presenting the items of a list in the same order is strongly recommended for every GUI. However the ordering logic should be part of the presentation layer. Different users will have different orderings. This should be stored as a user preference.

If you want a simpler solution just use a hardwired ordering, doesn't matter as long as you don't rely on unspecified behavior.

answered Oct 21, 2013 at 17:25
2
  • Alright, thank you, I was thinking that I should keep it separated. In the end, I believe the GUI will be designed so the user can move items around on the list as they please, so I'll store a numbered ordering for it to be recreated. Commented Oct 21, 2013 at 17:53
  • I disagree with this as an absolute statement. Certainly often the ordering of items is unique to each user, but there are times when the administrator will want to set the order that everyone else sees. Commented Oct 21, 2013 at 17:59
4

You are correct to avoid using the word index in the column name. I suggest that you avoid names that could be misinterpreted if you have a reasonable substitute.

One option is to call the column "SortOrder" or "DisplayOrder".

Is there a requirement for the list of items to be displayed or sorted in a particular order? If it's not required, you might save time by skipping it. On the other hand, sorting is a feature that many people do not think to ask for until the instant they see something that is not sorted to their liking.

answered Oct 21, 2013 at 17:26

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.