4 ms·
I don't think this is related to your ADHD. When your read a program it puts cognitive load on your brain. How much is a bit depended on your education and exp
by menotyou 3y ago
I don't think this is related to your ADHD.
When your read a program it puts cognitive load on your brain. How much is a bit depended on your education and experience on the subject, but what you have to do is to transfer what you are reading to your mental model what the program is actually doing. Your capacity of things you can process in your brain is limited so you can fairly assume that the more load is put on your brain the more of that capacity is used, and the nearer your are to your maximum capacity the more difficult and exhausting is the task to understand the program.
When you need to decode a "{" or a "@" in the program to a actual processing step. you can assume that
if (a) {
b;
}
else {
c;
}
is more difficult to decode compared to
IF a
THEN b
ELSE c
ENDIF.
simply the latter one is nearer to your natural language (I actually think to replace "ELSE" with "OTHERWISE" would be even better) and the "ELSE" implies both the opening and the closing braces.
You can argue if
a ? b : c;
is more readable, I would argue it is not.
It's not like special characters are always bad. For example
a->b
works quite well when a is pointer and the arrow "->" symbolizes graphically where a is actually pointing at. But nowadays we languages which use "->" and "=>" for different things and for their similarity they interfere which each other when doing the decoding and adding to the cognitive load.
When designing a language you have to trade of brevity or number of characters to type and readability. Most, if not all languages, nowadays opt for brevity because it appeals to the developers to type less and makes it more easy have more complex functionality in one statement. The price you pay is readability and finally maintainability of the program.
I think the first programming language which failed by its overuse of badly readable syntax was Perl, which was replaced by the much more easy to read Python.
I personally believe the psychology of programming is an under-researched subject
Disclosure: Alongside to CS I studied cognitive psychology when I attended university.
- alserio 3y ago> simply the latter one is nearer to your natural language (I actually think to replace "ELSE" with "OTHERWISE" would be even better) and the "ELSE" implies both the opening and the closing braces. Are there really studies that backup this claim? I _feel_ that I process programs and natural language very differently, that I don't look for the same things at all. I don't have a need to "read" the program as if it was text. I don't look for a natural grammar structure in it. And English is not my primary language, and it's not for a lot of people. But then, I've never studied cognitive psychology, and I cannot really say I trust what I think I know about how I process programs.
- magicalhippo 3y agoWhen I started out programming, it was Basic followed quickly by Turbo Pascal. I tried looking at C and C++ a bit later, but for years I found them hard to read, with the natural language keywords of Pascal feeling much more, well, natural. As I grew more experienced though, this has shifted. I took some time to really learn C and C++, and while I still use Pascal in my day job (Delphi), I now feel the natural language keywords "get in my way" a bit, and I prefer the brevity of curly braces and such. For me, this isn't about typing, I don't think that's a very interesting metric and I spend far more time thinking about my code than writing it regardless of language. The milliseconds saved typing "{" vs "begin" is irrelevant to me. For me it's about parsing. Once I trained my brain on the curly braces, the begin/end pairs take so much space so to speak, they kinda obscure what's really interesting. But before that, the natural language keywords helped me because my eyes and brain were trained to recognize them already. That said, I've looked at Rust code and yeah, I'm having that initial C/C++ vibe again, where it all looks like a mess of "random" symbols thrown together. I'd have to spend some serious time learning Rust for that to look acceptable I think.
- roydivision 3y agoThank you. You have described perfectly something I’ve only ever realised subconsciously. This makes so much sense.