if it doesn't work for you; it doesn't work for you.
Your personal productivity story doesn't have to be like anyone elses. As you work, start paying attention to what conditions seem to work better for you.
Different brains and bodies are different, and programming as a mentally strenuous activity requires that you pay attention to your mental wellness.