I feel like I have to be in a very specific head space to write code. It’s like climbing a big hill but in my head. Sometimes it’s effortless and sometimes it’s a slog.
Are there any proven exercises or techniques I can adopt that are proven to boost my ability to focus and get in that clear headspace to write code?
Edit: adding some tips as I try to figure this out. Note: not scientifically proven (to my knowledge)
1. Music. which type depends on the individual.
2. Timing. Dead of night or early in the morning when the world is quiet. Not this isn’t a muscle you can flex at any time, you have to just capitalize on the right time.
3. Long shower
4. Caffeine
5. Get out of the office/house go somewhere else (like a cafe)
6. Take a walk
7. Have a beer
8. Write thoughts down in a notebook without any phones/laptop in sight and then jump to the laptop to implement
9. Meditate
10. Lift weights / exercise to work the demons out and quiet the mind
Just a few studies (there are countless): https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3951958/ https://pubmed.ncbi.nlm.nih.gov/20065132/ https://pubmed.ncbi.nlm.nih.gov/35153701/ https://ju.se/download/18.4662178a174aa5f82061c573/160103080...