by onreact · 6y ago · 0 comments
The longer I worked the more bugs I introduced and the more I looked for the bugs in the evening the worse it became.
Ensure a proper work-life balance and plenty of screen-free time. Do not spend the night gaming when you work onscreen all day already.
The ideal per day work hours are 4h! No joke. In case you have to work 8h or longer perform simple tasks in the remaining 4h (meetings, documentation, emails, errands).
Eat well, get enough sleep, exercise, meditate, go outside and the next day you will find the bug and fix it within 10 minutes.
Many programmers tend to be the prototypical zombies who never see the light of day and only survive on caffeine (give it up). Remember that you're human.
I can easily spend more time on screen, before or after work. But getting back into development after work really takes a lot of mental energy for me.
I've never met a developer who could consistently do good work for over 40(ish) hours a week.
My rule with my teams is that I expect them to be "present" (even if remote) for 8 hours. The norm is about 6 hours of that to be actually coding, the rest is communication (which is vital).
If there's an urgent deadline, I'll let people stay to about 10 hours. After that, though, they're just going to be damaging the code base, so I send them home. And at this point, this became a scheduling fault rather than a developer fault. And the developer gets time off in lieu if they do >8 hours.
I've learnt this set of rules from experience. When I was younger, I thought I could code for days straight (and once pulled a 36 hour marathon, which was a disaster). I was wrong. I've watched lots of other people do the same.
If you don't believe it, try it. Pick a project and work at it for 12 hours straight, and compare your bug count / code quality in the first couple of hours to the last couple of hours.
Working longer hours does not "get more done". It just creates more problems.
The 40h work week has been introduced by Henry Ford 100 years ago because even in factories with dumb menial work people were getting tired and breaking more than making after 40h.
In creative industries that require programming, graphic design, writing etc. you can't assume that people will be doing good work for as long as factory workers do who only have to focus on the same repetitive tasks.
Obviously if you're doing routine work you'll be able to carry on much longer.
Concentrated coding is a bit like doing a college math exam every single day.
However, if 4h limit really exists, imo, it will be about focused hard stuff. Many many programming tasks are not difficult and you can safely easily do them longer. You can also mix programming with analysis, architecture, design, helping people etc etc easily being able to productively occupy yourself for more.