This is just a quick quote from the course description of a ten year old course in Cognitive Psychology and Computer Programming at the Texas A&M:
Computer programming perhaps more than any other manufacturing endeavor begins with a thought and through skilled application of knowledge yields an intrinsically proven object that is itself almost mental (encoded electrical information).
It’s a good argument for why cognitive psychology is relevant for computer programming, but even more important, it points out the almost mental nature of computer programs.
Physiologically, the way our brains operate is mainly through bursts of electrical current called Action Potentials, that propagate information down neurons in a on-off fashion. Some people will call it binary, but the information conveyed is typically frequencies rather than binary patterns (But this is a somewhat contentious question).
Here’s a beautiful drawing of neural communication from Wikipedia:
So you have a mental construction in a human brain contained in electrical signals, and this is transferred over to a construction of electrical signals in a computer. Add that you usually want these two representations to be identical, you have a good argument why programming language design should be based strongly on cognitive science!