3 ms·
There's a hidden premise in your argument that I would argue is false, and that's that programming languages should attempt to emulate the same principles as na
by andolanra 11y ago
There's a hidden premise in your argument that I would argue is false, and that's that programming languages should attempt to emulate the same principles as natural languages. Programming languages and natural languages do not at all fill the same niche, and there are many cases in which natural languages optimize for things that would be bad in programming languages.
For example, natural languages are infamously redundant—for example, gender agreement between nouns and adjectives and even (in some languages) verbs—but that's because they developed so that they could be understood even if you were shouting over the wind or otherwise didn't hear part of the sentence. Programming languages have no such restrictions, and as such, optimizing a programming language for the same kind of redundancy as a natural language would lead to needless tedium like
int x = int_addition(int 2, int 3);
but in the context of a programming language, this kind of redundancy ends up being needless bookkeeping without presenting any of the same advantages of redundancy in natural language.
That doesn't mean that your conclusions are wrong—I think some parameter orderings are better than others! But I think that's true for reasons orthogonal to the findings in this paper.
- AnimalMuppet 11y agoI agree that you don't (shouldn't!) have the redundancy in computer languages. But I think the point of the article is that some word orderings cause less load on our brains. I think that's directly applicable to function parameters. For example, if I have a function that takes an array, a starting offset, an ending offset, and a value to search for within those offsets, then int limitedSearch(int *array, int startOffset, int endOffset, int searchValue) causes less cognitive load than int limitedSearch(int *array, int searchValue, int startOffset, int endOffset) simply because the offsets "go with" the array to make up one concept (where you're searching). There may be other reasons why some parameter orderings are better than others, but I think the article is directly relevant.