Disclaimer: It is not your fault if you are in a situation where you have to work uncompensated extra hours. Sometimes it is hard to find a job; changes can be scary, so you stick to whatever you have at the moment. However, it is also not normal, and in most countries, it is a violation of labour laws. Please don't put up with it; there are better places to work.
It used to be common for an employer to convince employees that working uncompensated extra hours is good - that it makes you "a part of the family", it shows your loyalty. Sometimes your next promotion depends on how many extra hours you worked. Luckily, this abusive practice is becoming a thing of the past. So I'm going to talk about situations when developers choose to work extra hours.
It is especially in the COVID era that many people felt like they don't work enough, so they started spending 9-10 hours working from home. I made an effort to limit my workday to 8 hours, and from time to time, I remind my colleagues and friends to do so.
The tricky part is that we have to use the brain to estimate how tired our brain is. A tired brain tends to make lousy conclusions. The same happens when evaluating how drunk or how underslept we are. Only by using external markers (counting glasses of beer, hours of sleep, or hours of work) can we gain a somewhat reliable understanding of our mental state. Even if you feel like you are as efficient as in the morning, your brain might be just lying to you.
We have an 8-hours workday only because in 19th-century striking workers negotiated to reduce it from 10 hours. I assume the work at that time was very different from what we do today. Are the same standards applicable to modern intellectual jobs?
The most important result of a developer's work is not the code but all the decisions you make while writing that code. Making decisions requires willpower which depletes during the day. The more tired you are, the more you are inclined to cheat, take shortcuts, avoid difficult conversations. In software development, that doesn't lead to good things.
(A great book on willpower is "The Willpower Instinct" by Kelly McGonigal")
If one of your team members consistently works more than 8 hours, it's a sign that something goes wrong.
The most probable reason is a project being delayed. The developer sees that a delay is inevitable and tries to make an extra effort. It could be because she feels personally responsible. It also could be that she tries to protect herself from being blamed when the delay becomes obvious.
It is great if you can catch this early, because:
- First, now you know that the project is getting delayed, and you have time to reconsider the plans.
- Second, it is a great chance to show the developer that you care about her mental health and psychological safety. It is more important to have consistent productivity every day than try to burn yourself fast. Overworking does lead to burnout, especially when you realize that your two extra hours per day can't "save" the project.
- Finally, it is a chance to explain that changing plans is usual in software development. Either you have 1) a fixed project scope and a flexible deadline or 2) a flexible scope and a fixed deadline. Both fixed scope and a fixed deadline is unrealistic. (This is borrowed from "Shape Up" by Ryan Singer)
In summary, nobody benefits from one developer working uncompensated extra hours. The quality and speed go down, the developer suffers mentally, they will need time to recover later, and their sacrifice is essentially for nothing.
Some developers think that newcomers/junior developers should invest extra time in learning the new codebase. Others say: "I wouldn't encourage it, but I would do it myself". In my opinion, it depends on factors like the person's ambitions and the complexity/importance of their work. The more important the work, the more I insist on a maximum of 8 hours per day. However, in the first 3-6 months, people usually have relatively safe tasks. If it is just reading and learning, I will only remind them that they don't have to work more than 8 hours.