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:
- A percentage, passed as an integer.
- 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.
2
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]
, withx >= 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.