best hours for coding/doing mental work

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
krautersuppe
Posts: 91
Joined: September 14th, 2015, 10:58 pm
Location: Istanbul

best hours for coding/doing mental work

Post by krautersuppe » November 2nd, 2018, 4:49 pm

I have been struggling to do mental work for quite some time(like, forever :lol: ) so maybe an exchange of thoughts with other forum members wouldn't hurt.

I especially find it almost impossible to do coding if I lack sleep, I have worked in night/morning shifts for last ~2 years and I could never wake up without alarm or I would go sleep too late so that I would get dizzy on the next day and at best consume some food, watch some youtube for entertainment, play some video games and maybe do some house-work(and that also on a good day) or try to sleep out remaining hours which would lead me to only more dizziness. If I tried to do some coding/reading I would end up trying for like 10 minutes and give up to "easier" activities because my attention span for mental work is literally non-existent when tired. Only time when I could actually do mental work in my spare time would be 1 day of the weekend where I would have properly slept out and recovered.
To anyone who is searching for employment I would suggest avoiding shift-work if possible.
Although I must mention that school/work starting at 7-8 AM was also too early for me and would lead to me being in a kind of similar stupor.

Now let's assume I have had plenty of sleep, next factor would probably be level of hunger. If that is not satisfied I would find it hard to concentrate, and if I am staying too hungry for too long that would lead to overeating and sleepiness. Some time ago I used caffeine containing drinks(like tea or hot cocoa) but I have given up on that because it makes me consume more sugar which again makes me more sleepy afterwards and has an impact on my sleep cycle. There are also some food groups that arguably make me tired but it depends - i would probably say that starch-heavy products(potatoes,rice,bread) and yogurt are culprits.

Besides that I would mention fresh air and time spent outdoors as a factor too. I live in a town, I do have a chance to go outside , however I mostly am able to do that when conditions of sleep and food are already satisfied. My flat is on the street and southeast side and is not that easy to ventilate. So either less fresh air or too noisy and too cold. And if I am hungry it makes me stay inside and not go out to get fresh air and sunlight and that makes me sleepy. I don't know how would it look like if I would live in a countryside, maybe someone can exchange his experiences.

So yeah, if I have had plenty of sleep, I am not hungry and climate is nice I can probably do some mental work between 10AM and 1PM and after that somewhere at evening between 7PM and 1AM.
Now there are also some other "distractions" competing with my ability to do coding, mostly entertainment. If I lose focus on coding/reading because something gets complicated I would turn to easier occupations to pass my time, like consuming online media.

I am not able to understand how one can do programming as an office work effectively with set hours starting in the morning and lasting 8 hours if (even under optimal conditions) I can do like max 1,5 hours of effective mental work per day. And when I try to do more - like when I have set a goal to do something I try it for like 10 days and burn out out after that for months regardless if I reached my goal or not.
Maybe if someone does all the housework and provides one with pleasant workspace it gets easier and one can spend more hours in the office(I doubt though that it increases the absolute number of mental work hours that can be done in a day). But even then one first needs to get to the office and that already distracts schedule because of stress of getting there in time.

So yeah - hard world out there - what are your experiences? Are there forum members living in the countryside/major city and how are things around there?
DSU
Discord: dsu1, GitHub: https://github.com/DSpUz

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: best hours for coding/doing mental work

Post by albinopapa » November 2nd, 2018, 6:57 pm

Wow, it's nice ( or a shame ) to see someone with almost the same difficulties as me. I'm have albinism so I don't venture outside unless I have to for the most part. The sun and I don't get along and I hate wearing sunscreen. I don't like wearing sunglasses, because it messes with what little depth perception I have, so I spend most my time indoors.

There are things that I have found that invigorate my creative juices, but have troubles employing them on command. Like you, the major one is sleep, but it can't be sleep alone. One of the issues I have is when I have the creative juices flowing, I can't just separate work from rest. I tend to try exhausting my ideas before going to bed, else fail at falling asleep in a reasonable amount of time once my head hits the pillow.

Then, after about a week or week and a half of stuff working out or not, I get so drained and I have to unplug, same as you. I've cut down the amount of down time between coding sprints from a couple of months to just under a month. One way is to work on multiple projects or multiple parts of a project. I've gone from coding and running into a wall to maybe some animated sprites that I can use for the project I'm working on.

Of course, I can't give you anything substantial as all of my projects have either ended in a demo/simulation type state or too complicated for my skill level either in coding or mathematics.

I keep telling myself to just learn some damn linear algebra already and get it over with, but most of the material I find I can't seem to understand. Even your stuff I can only grasp bits and pieces and I don't even know what questions to ask to help me understand. I use to say that math in code was easier to understand than regular math notation, but going over the math in the Box2D library I might have to retract that statement. I think some of it is the use of variable names, in the Box2D library the author uses one or two letters ( like I for inertia and wA/wB for angular velocity for entity A or B ). While I have figured those out, another issue is not storing the algorithms in a function, so it's hard to separate the physics calculations from game logic ( like this section determines overlapping, this section determines rebounding, this section calculates which entity needs to rebound ). Some of these functions are like 600 lines long and it would be nice to be able to look through the code and determine what code can be put into it's own descriptively name function.

Anyway, way off topic. The hunger thing isn't really an issue for me. While sugar doesn't make me sleepy, I do get shaky which makes concentrating and motor functions difficult, so I avoid it mostly, but I can always just drink a glass of milk to help steady myself. Caffeine doesn't affect me too much, then again I only ever drink up to 32oz of a caffeinated beverage a day, either tea or diet soda, but mostly only a 12 oz can of diet soda.

I've noticed that when I have exhausted my creative juices, sleep comes much quicker though the quality of sleep is lacking or am just having troubles fully catching up from the coding sprints. Once that is taken care of, I can usually go back to coding.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: best hours for coding/doing mental work

Post by albinopapa » November 2nd, 2018, 7:00 pm

Oh, and best hours for coding for me are between noon and 2 pm, then again between 10 pm and 2 am. That being said, I believe those hours have more to do with the amount of distractions are greater between 2 pm and 10 pm with family and other activities, at least for me it is.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Post Reply