11/28/2016 01:54 pm ET Updated Nov 29, 2017

Five Surprising Ways Engineers Can Improve Their Stamina at Work

What are some techniques for mental stamina as a software engineer? originally appeared on Quora: the knowledge sharing network where compelling questions are answered by people with unique insights.

Answer by Alex Ellis, software/machine learning engineer, on Quora:

While I'm relatively new to software engineering, I have been coding in some form or another since my teens, and I've spent quite a few years studying and doing research in math (and a bit in physics). Here are a few techniques I've found helpful in tackling large, quantitative problems.

  • Change scenery often and according to the task at hand. Do you prefer quiet, secluded spaces (home, office) or noisier, public places (coffee shop)? Try both. I do my best editing in a quiet place, but some of my best research thinking was done at coffees shops. Also, getting up and walking somewhere else forces your brain to context switch. While this is the worst possible thing for tasks involving a lot working memory (e.g. a calculation), it's great for gaining perspective when you're stuck on something more conceptual. You won't make tactical advances, but you might change your strategy.
  • Walk more, and without headphones. Generally, I want to try and download as much information into my head as possible. I listen to podcasts and audiobooks constantly. But when I'm working on a difficult project, I force myself to walk places with no audio stimulation. Some of my best research insights came while walking. I've saved myself days of calculating by having a key insight during a thirty minute walk.
  • Meditate. This one is a more recent addition for me, but it's been amazing so far. Highly recommended. If you're not sure where to start, check out the Headspace app. There is no spiritual component here; it's a psychological practice and technique. It's just another form of exercise.
  • Take care of your health. You can push out a big chunk of code by staying up late and binging on caffeine and junk food. We've all done it. The immediate issue here is that your work will be of low quality. More importantly, though, this is totally unsustainable. The best productivity comes from sleeping well, eating well, spending time with the people you care about, and exercising; think of your work as what comes in between these essential human activities.
  • Most importantly, find out what works for you. The above works for me. It works for a lot of people. But everyone is different! My most productive hours, when I'm awake for them, are between 5am and 9am. The only way to find yours is to experiment widely, while keeping your physical, mental, and emotional, health in balance.

You'll notice that I didn't directly address stamina at all. I promise, though, that focusing on high quality, sustainable work will allow you do be happy and productive. And I suspect that "stamina" is just a tool for you to achieve happiness and productivity. I'll also point out that mindfulness meditation does seem to increase stamina quite directly.

This question originally appeared on Quora. Ask a question, get a great answer. Learn from experts and access insider knowledge. You can follow Quora on Twitter, Facebook, and Google+.

More questions: