If we habitually do hard things, then we generally have no problem, stepping up to the plate, for when it’s showtime.
Same reason that musicians practice scales, all the time.
I write code, every day. I walk 5K, every day. I solve problems, every day (detect a pattern, here?). It makes showtime a lot less stressful, and folks seem happy with my work.
First thing I do, is a 5K brisk walk. Gets the exercise quota satisfied. I tried running, but kept injuring myself, so walking, it is. I can do that, seven days a week. Takes a bit less than an hour (I walk about 10min/Km).
I usually "triage" my day, on these walks. I mentally sort through the tasks ahead, and scope out my plans. Sometimes, it's straightforward, other times, I have to develop a plan.
When I get home, I hit the shower, and generally start coding, right away. I code throughout the day, taking breaks as I need/want. I have no issue, stopping work for a couple of hours, and watching some TV or even taking a short nap.
I'll code at any time. I don't have a "set" workday.
I have found that I am most productive in the morning, and most creative at night, but I sometimes find myself losing focus, towards the end of the day. When that happens, I generally wrap things up, as I do more damage than good. I'll often fix a bug in my head during my walk, that was confounding me the night before.
I believe in F^3 - Finite, Focused, and Finished.
- Finite: I know what "done" looks like. Tasks have a discrete beginning and end, though the schedule may be fuzzy.
- Focused: No distractions. I stay on beam, and devote full attention to the task at hand.
- Finished: I don't stop, until I have reached a point that I can wrap things. I usually punctuate this with a final tagged commit.
It's also important to scope things reasonably. Stretch, but not too much.
I write about that stuff here: https://littlegreenviper.com/miscellany/thats-not-what-ships...
I probably have a life a lot of folks around here would not find attractive. I find it WFM. YMMV.
I think we make kids hate school via "sucking it up" when we really don't have to. Learning to write in the right context is much more effective than learning in the wrong context. But our educational system is so standardize that we have to fit most kids into the same interest peg.
These days, that would be considered insane! But in 1989...
[1] https://en.wikipedia.org/wiki/Itzhak_Perlman#/media/File:Itz...