Linguistic-Antipatterns / linguistic-antipatterns.github.io

Linguistic Antipatterns
Eclipse Public License 2.0
30 stars 3 forks source link

"incoherent names" as antipattern? #14

Open bohrium opened 2 years ago

bohrium commented 2 years ago

Might "confusable names" have a sibling in "incoherent names"? I mainly have in mind that a family of methods should all use the same metaphor for their names.

Example A: this iterable is like a stream of water (rather than a roofer's ladder) so we will use words like "skip" or "pipe" or "into" rather than "jump" or "onstep" or "extendby"

Example B: this concurrency protocol is like a debate (rather than a ballet) so we will use words like "cede" or "raise" or "stall" rather than "follow" or "propose" or "wait".).

Do you consider it a mistake worth taxonomizing to lack such coherence?

jkoppel commented 1 year ago

Strange that I didn't receive a notification when this was written.

So, the idea is that using mixed metaphors is an anti-pattern?

Could be worth exploring.

Do you have any concrete examples of this anti-pattern, esp examples of it causing confusion?

bohrium commented 1 year ago

Strange that I didn't receive a notification when this was written.

So, the idea is that using mixed metaphors is an anti-pattern?

yep.

Could be worth exploring.

Do you have any concrete examples of this anti-pattern, esp examples of it causing confusion

short answer: no. Outside of machine learning, I program just for fun, and what I find fun is to build small things from scratch. So I have little idea about real world codebases. I was hoping you'd have examples I'd learn from :-)

That said, here are two not-so-satisfactory examples:

(A) "folder" vs "directory" language for file systems. The two metaphors connote different intuitions about ownership and aliasing, yet Windows (and macos?) exposes both words to users (e.g. as far as i recall: one can compress (a folder) yet remove (a directory) in windows). -- not a good example cuz it relates to UI more than deep structure of project. -- Daniel Jackson notes that dropbox confuses users about when "delete" means "destroy" vs "hide". Idk whether this mix-up is reflected in the api --- maybe look at https://www.dropbox.com/developers/documentation/http/documentation#files-delete:2 to see. You collaborate a lot with him, right? I bet he'd have great examples. -- likewise, consider C++ STL's iterators. Are they passive "ambulators" or instead active "generators"? Words like "prev" suggest the former; words like "transform", the latter. In lazy immutable land these two viewpoints coexist peacefully: we may evaluate and cache values as needed. But (to my very novice mind) the STL situation is confusing. (Digression: some surprises also lurk here regarding "ownership of computations", i.e. which things return thunks: https://www.fluentcpp.com/2019/02/12/the-terrible-problem-of-incrementing-a-smart-iterator/). I have no experience with C++'s newfangled "ranges" or "spans". -- If one squints, the concept of a "null pointer" belongs in this example. I think what leads to that language is a conflation of pointees-as-addresses vs pointees-as-data-objects, two distinct disciplines of thought that C culture keeps straight but that C++ blends https://en.wikipedia.org/wiki/Juicero. This famously expensive "thousand dollar mistake" seems to appear in every intro talk on sum types haha. I like Zig's way (maybe also GHC's when dealing with unlifted data??) of predictably compiling down "simple" sum types without memory overhead by using un-used least significant bits.

(B) was gonna write two examples but running out of steam. this example has to do with dynamic tensor packages such as pytorch. Is a tensor a "static" node in a computation graph or instead a run-time value named by that node? Words like "gradient" suggest the former; "shape", the latter. Etc.

On Wed, Nov 2, 2022, 16:50 Jimmy Koppel @.***> wrote:

Strange that I didn't receive a notification when this was written.

So, the idea is that using mixed metaphors is an anti-pattern?

Could be worth exploring.

Do you have any concrete examples of this anti-pattern, esp examples of it causing confusion?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread. Message ID: <Linguistic-Antipatterns/ @.***>

jkoppel commented 1 year ago

Okay, I like the C++ example. Some of the other examples sound more like concept confusion and conflation of runtime vs. compile time values. The folder vs. directory one strikes me as very benign, probably because I'm so used to it that.....when was the last time you heard "directory" to mean something other than a folder on a file system?

This famously expensive "thousand dollar mistake" seems to appear in every intro talk on sum types haha.

What mistake? I don't know what this is.

bohrium commented 1 year ago

Okay, I like the C++ example.

hooray! you should ask a C++ expert about it. I don't guarantee that the confusion noted is actually confusing to people besides me.

Some of the other examples sound more like concept confusion and conflation of runtime vs. compile time values.

agree almost entirely. the way I see it, concept confusion and runtimeVsCompiletime confusion can lead to bad naming that furthers that confusion. still, I don't find my examples satisfactory.

The folder vs. directory one strikes me as very benign, probably because I'm so used to it that...

same :-) what do you think Daniel thinks?

This famously expensive "thousand dollar mistake" seems to appear in every intro talk on sum types haha.

mistake == "the use of null pointers to get the behavior of a maybe type." i think it was tony hoare who called it his expensive mistake. it is a design decision he notes as historically borne of laziness --- a more structurally enforced maybe type wouldn't have been hard even for old compilers to manipulate and optimize

On Tue, Nov 15, 2022 at 8:14 AM Jimmy Koppel @.***> wrote:

Okay, I like the C++ example. Some of the other examples sound more like concept confusion and conflation of runtime vs. compile time values. The folder vs. directory one strikes me as very benign, probably because I'm so used to it that.....when was the last time you heard "directory" to mean something other than a folder on a file system?

This famously expensive "thousand dollar mistake" seems to appear in every intro talk on sum types haha.

What mistake? I don't know what this is.

— Reply to this email directly, view it on GitHub https://github.com/Linguistic-Antipatterns/linguistic-antipatterns.github.io/issues/14#issuecomment-1315296002, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEODPYCASL72RJQYVV4DNODWIOECBANCNFSM6AAAAAAQRLHXTM . You are receiving this because you authored the thread.Message ID: <Linguistic-Antipatterns/linguistic-antipatterns.github. @.***>

jkoppel commented 1 year ago

Oh! That's the billion dollar mistake. I thought you were talking about something else.

bohrium commented 1 year ago

ah oops i forgot which was the right power of ten haha

On Tue, Nov 15, 2022 at 2:22 PM Jimmy Koppel @.***> wrote:

Oh! That's the billion dollar mistake. I thought you were talking about something else.

— Reply to this email directly, view it on GitHub https://github.com/Linguistic-Antipatterns/linguistic-antipatterns.github.io/issues/14#issuecomment-1315763611, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEODPYB4YVCEJAKNDZH3PHDWIPPHTANCNFSM6AAAAAAQRLHXTM . You are receiving this because you authored the thread.Message ID: <Linguistic-Antipatterns/linguistic-antipatterns.github. @.***>