johnmyleswhite / Style.jl

Style guideline for Julia
74 stars 12 forks source link

extremely short name should not be considered as good style #2

Closed byronyi closed 9 years ago

byronyi commented 9 years ago

isna is not readable and confusing. I think it is actually worse than the latter two.

(12) When naming variables or functions, use short lowercase names if possible:

Good style

isna
Bad style

isNotAvailable, is_not_available
astrieanna commented 9 years ago

I agree with this; I'd much prefer either of the "bad style" versions.

johnmyleswhite commented 9 years ago

I broadly agree with the spirit of this comment, but this specific example is problematic.

(1) The type being checked by the predicate isna is called NAtype. It's not called NotAvailableType.

(2) NA is a very commonly used acronym in statistics. Its full expansion as "not available" is substantially less familiar to statisticians than the acronym.

We should figure out what kinds of names are too long. But I think we shouldn't advocate for fully expanding all acronyms. So we need some other kind of example to focus our discussion.