7

I'm developing an engineering application which stores data in C arrays. When a user edits data representing one of the items of the array, I want to be able to show the item number they're editing.

Item 16 of 72 (maximum 5000), last modified one hour ago

The problem is, we have an accompanying programming language (which most of our users are familiar with) that stores values in zero-based arrays. We can expect the users would be comfortable with zero-based arrays. However, what to do about edge cases?

I'm ok with seeing this on screen:

Item 0 of 72 (maximum 5000), last modified one hour ago

but the last element will be:

Item 71 of 72 (maximum 5000), last modified two years ago

and that just seems wrong to me.

Additionally, users can use these indices in the accompanying programming language, so it wouldn't be right just to add 1 to the index to move (0..71) to (1..72).

Any suggestions on how to display this to the user so it's clear that the indices go from 0..71 while there are 72 items? This is the closest I've gotten, but it seems unwieldy.

Item 16 (0..71), maximum 5000, last modified just now

Thanks!

4 Answers 4

1

Here we have 2 entities - 'index' (0...71) and 'number' (1...72). It's obvious that usually we use numbering, but using indexes is implied. Also, 'number' is item's property but 'index' is array property, i.e. property of some storage. You should abstract from storage and reference your main entity - item. What reference will you use when you out of context of your site, say, discussing with another people?

I think number should be used regardless of storage index. You can change your storage to basic or another language, so you have to change your site. Number is more universal. Optionally you can display index, e.g.:

Item 16 of 72, last modified one hour ago (item[15] in array, array length 5000)

2
  • This is the wordiest answer, but I think is the most clear. Thank you! Mar 5, 2013 at 18:49
  • :-) Poor knowledge of English foreces to use too many words.. Thanks
    – Serg
    Mar 5, 2013 at 18:57
7

Don't mix your counting systems.

If you are dealing with a technical audience who are happy counting from zero, then you need to do that consistently. If you have 72 items, and are starting at zero, your message should read something like:

Item 16 of 71 (maximum 5000), last modified one hour ago

Note that it is of 71 and 72.

If you are going to start counting from 1, then the same item would now be:

Item 17 of 72 (maximum 5000), last modified one hour ago

I would suggest counting from zero, but using terminology that makes this clearer. Something along the lines of:

Item at index 0 of 71 ...

The moment you're referring to it as an index, any C developer should assume it is counting from 0.


In the end you really need to test this with your customers to know which will be the clearest choice.

2

Base your ordinals on an index of zero, and use the word "index" consistently. In the cases you outline, that means "Item at index 0 of 71" / "Item at index 71 of 71".

Even if the user does not grasp that the array starts at position zero, the fact that the numbers in your application and the numbers your users have to enter into their code are the same prevents errors. It also helps them in their programming tasks by letting them confirm they've referred to the right element by seeing, at a glance, that the digits match.

0

Item 71 of 72

This is terribly confusing (and I'm a programmer) because it's an English with C semantics. If you must use C semantics in indexing it should be made explicit, which your suggestion here does:

Item 16 (0..71), maximum 5000, last modified just now

Or maybe use a C-like syntax:

(0..71) [16] // maximum 5000, last modified just now

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.