2

I have a parameter for a program that is a threshold (T). I need to document it, and what I want its meaning to be is this:

  • If N >= T then Do Action

I don't want its meaning to be this:

  • If N > T then Do Action

For ease of discussing this, let us say that N is "number of ghosts I've seen", and Action is "freak out". So my threshold might be 3, as in "If I see 3 or more ghosts, I'm going to freak out."

  • See no ghosts — fine and dandy
  • See 1 ghost — still ok, maybe it's a shadow
  • See 2 ghosts — ok, maybe it's a shadow and a mirror
  • See 3 ghosts — freak out; leave haunted house now, call Ghost Busters
  • See 4 ghosts — still freaking out, etc.

But the best phrasing for a threshold description that I've seen so far is this:

  • T = the number of ghosts that can be seen before a freak out occurs

Which implies that for T=3 I could see 3, and a freak out would not yet occur until a fourth ghost is seen.

How can I wrangle the threshold description to fix this off-by-one issue?

3 Answers 3

2

If you're documenting code, I'd recommend looking at industry standards. I found several properties on the MSDN (Microsoft Developer's Network) that might help you:

  • The ApprovalActivity.Threshold property is documented as "This value indicates the total number of approvals that are required in order to approve the request."
  • The GeoCoordinateWatcher.MovementThreshold property is documented as "The distance that must be moved, in meters, relative to the coordinate from the last PositionChanged event, before the location provider raises another PositionChanged event."

The first property is an int (whole number) and the second one is a double (a non-whole number), which might explain away the "before" off-by-one issue you're having. So, if your parameter is also an int, I might recommend:

"This value indicates the number of ghosts that are required to be seen to trigger a freak-out"

2

"The smallest number of ghosts that must be seen for a freak-out to occur."

1
0

The phrasing “See 3 or more ghosts” is unambiguous, clear, and reasonably concise. The phrasing “See not less than 3 ghosts” also is is concise and unambiguous (because “greater than or equal to” is logically equivalent to “not less than”). However, “x or more” probably will be more quickly understood by more people than will “not less than x”.

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.