I find that this is the biggest pain point for me. When I am working on a task, it usually ends up spanning several files. And I just don't have very good memory.<p>I struggle to remember if I had some new variable in the Logger or the Worker, etc. It's usually trivial to see the list of files I'm working in and check between a couple, but I'd love to know if anyone has a memory palace kind of technique they use for programming.
I think 2 things are helpful.<p>(1) Know that your memory and concentration will suffer if you are distracted or have lots of context switching. Try and change your coding environment (IRL) to suit this fact.<p>(2) Make sure you are using the tools provided by a good IDE. Many IDEs will autocomplete variables/functions/modules which are in scope of where the cursor is. Make sure you have convenient+relevant IDE extensions/plug-ins for your language+libraries running.<p>There are exercises you can do to increase your memory, but I think your programming ergonomics are bad if you have to resort to that.