Trying to code and listening to music falls under cognitive functions. Naming a variable while listening to your favorite songs' lyrics may result in cognitive overload.
Imagine trying to clean utensils and cook food at the same time. They both fall under physical function, and the switching between them is a huge waste of time. Cleaning hands, wiping them, cleaning water droplets, make sure soapy water doesn't splash near cooked food, etc., takes time whenever you switch from washing dishes to cooking food.
One of the effective ways to counter context switching costs is by following the sage advice of batching. More tactically, batching tasks by function.
The best analogy is sorting forks, knives, and spoons when we are putting them in drawers. We can throw all silverware together. But then finding a spoon in that pile will take time whenever we need a spoon. The task changes from getting a spoon (execution) to finding a spoon (identification). And that's a cost we want to avoid.
❤️ Brainstash Inc.