4
$\begingroup$

In some programming languages type of variable goes before it's name. In another - name goes first and then type. Which version loads brain less and allow easier think about problem ?

$\endgroup$
  • 1
    $\begingroup$ I think that your question is off-topic here. It is rather pure cognitive psychology. $\endgroup$ – Evil Feb 28 '18 at 4:09
  • 1
    $\begingroup$ @Evil There are empirical studies under the aegis of CS of questions of this sort, e.g. is for or repeat a better keyword. I would lean towards them being on-topic, though the question would need a more quantifiable metric, e.g. bug count or number of hours to complete a standardized task. No one cares if your brain is loaded more or less if you produce correct code quicker, though presumably those are (negatively) correlated. $\endgroup$ – Derek Elkins Feb 28 '18 at 4:36
  • $\begingroup$ @DerekElkins I am reading papers now, just under the Cognitive Psychology aegis. The pure perception and brain load is rather off here. And honestly it makes sense when the group is defined (not programming, beginners, experts), where for experts it does not make any sense. My point is, that the "brain load" is cogPsy, while the other reasons are for example given at SE. "No one cares if your brain is loaded more or less" - psychologists do... $\endgroup$ – Evil Feb 28 '18 at 4:46
  • 3
    $\begingroup$ related on Software Engineering: Why does the type go after the variable name in modern programming languages? (also specific questions about Kotlin and Scala) - no empirical studies but good arguments $\endgroup$ – Bergi Feb 28 '18 at 8:39
  • 1
    $\begingroup$ @tmlen That probably depends on your mother tongue $\endgroup$ – TheEspinosa Feb 28 '18 at 9:25
7
$\begingroup$

I don't think there is any research (with good methodology) on this. The language I'd most expect to have actually thought about this and made an empirically-based decision is the Quorum programming language. It uses a "type before variable name" approach (though it does put the return type of a method declaration after the parameter list). However, what I believe is the primary source for the language design decisions, An Empirical Investigation into Programming Language Syntax (available via the first author's web site), does not mention this aspect or suggest that it was studied in the research reported on in that paper. There is other research by that group and research by others that was used to design Quorum, so it's possible it is covered in that other research. I haven't read it all. You can try contacting one of the creators of Quorum and asking them if they made that decision based on empirical research. If you do and you get a positive response, I would highly recommend self-answering this question with a reference to the research.

$\endgroup$

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.