I have been considering the following situation as part of documenting and interface (A) and an implementation (B) of that interface.

The interface A contains methods which involve the following two arguments:

  1. A percentage, passed as an integer.
  2. A name, passed as a string.

The valid values for the percentage are the closed range [0, 100]. No matter how you implement the interface, it is an error to allow a value outside this range as an input.

The name, as defined in the interface, allows any string containing [1, 100] characters. I want to document the interface in such a way that it neither requires nor disallows an implementation to support a name with more than 100 characters.

Clearly the valid range for percentage is a closed, inclusive interval. How would you refer to a range like I defined above for the number of characters in name? I can't refer to the interval as right-open, because the implementation might not support values with more than 100 characters.

migrated from cs.stackexchange.com Sep 15 '13 at 10:24

This question came from our site for students, researchers and practitioners of computer science.

  • @Dukeling can you remove that comment and add it as an answer? – 280Z28 Sep 14 '13 at 2:45
  • Added as an answer, with a bit more ... stuff. – Dukeling Sep 21 '13 at 22:02

I don't believe there's a specific name for it, you'll probably have to write it out, e.g.:

The minimum length of name must be 1. There is no strict maximum length, but any implementation must support a maximum length of at least 100.

This is more concise, although somewhat less clear:

Any implementation must support a minimum length of name of 1 and a maximum of at least 100.

You can also write:

Any implementation must support the length of name in the range [1,x], with x >= 100 (x is chosen by the implementation).

Which is similar to your comment in the question on CS which was lost in the merge.

It might also be a good idea to add this to any / all of the above:

... and throw a YouNeedToRenameThis exception when outside this range.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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