Guava: Replace 'iff' by 'if' in docs.

Created on 21 Oct 2016  路  7Comments  路  Source: google/guava

Just a minor issue, but many javadocs of the new common.graph package contain a specific typo, using the word (?) "iff" instead of "if" in conditional expressions, e.g. "Returns true iff graph has at least one cycle."
Maybe you like to fix this by a package-global search/replace?

package=graph status=triaged type=api-docs

Most helpful comment

But then again, it's not a word I've personally seen used in _any_ context apart from Guava and Spotless, and I'm a born Englishman. (Is it a word that originated in the US perhaps?)

We were never taught the term in our lectures at university, and I don't remember coming across it in any computer science literature I've read. We always used the phrase "if and only if" instead, so I thought "iff" was a typo too until I searched it up a few days ago. So I'm not surprised at all by @m-berling's confusion on this.

So I think it's worth replacing all occurrences of "iff" with "if and only if" in the javadocs, if only to make things explicit and clearer.

All 7 comments

That's not a typo; it means "if and only if".

Oops, sorry did not know this, being not a native English speaker.

Something learned again, thx!

But then again, it's not a word I've personally seen used in _any_ context apart from Guava and Spotless, and I'm a born Englishman. (Is it a word that originated in the US perhaps?)

We were never taught the term in our lectures at university, and I don't remember coming across it in any computer science literature I've read. We always used the phrase "if and only if" instead, so I thought "iff" was a typo too until I searched it up a few days ago. So I'm not surprised at all by @m-berling's confusion on this.

So I think it's worth replacing all occurrences of "iff" with "if and only if" in the javadocs, if only to make things explicit and clearer.

Maybe the term is more common in mathematics and logic. I'm not a native speaker and I thought it was actually quite well known.

Personally I like its brevity, but I recall seeing a PR to "fix" a similar typo in some other project a few months ago. So indeed, a case can be made that it's better to be explicit.

Thanks for your comments, @jbduncan and @Stephan202! Yes, according to Wikipedia it is more common in logic, maths and philosophy, and I think it is quite useful there (iff you know this term).
AFAIK there is no similar abbreviation in German language, so I was not aware of it at all.

IMHO, in the current context of the graph package, the "iff" (or "if and only if") could easily be replaced by a simple "if" in most cases: "Returns true if graph has at least one cycle." Especially, this would conform to the common usage throughout the Guava API docs, e.g. Strings.isNullOrEmpty(): "Returns true if the given string is null or is the empty string."

Well, I'm just reopening this issue to let the people at guava decide... It is a very minor issue, anyway.

Thanks for opening this. Our not-well-enforced policy has been to never use "iff" (or "e.g.", or "i.e.", or really most abbreviations) in our javadoc.

This has been fixed per the above commit.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thecoop picture thecoop  路  4Comments

edwardlee03 picture edwardlee03  路  4Comments

cowwoc picture cowwoc  路  3Comments

cpovirk picture cpovirk  路  5Comments

PhilippWendler picture PhilippWendler  路  4Comments