Ask HN: How many hours can you productively program a day?
I'm just negotiating a freelance job with a company, who want 'day' rate quoted. Being me, I want to define day: usually it'd be 8 hours.
However, I know I cannot program productively for a solid 8 hours.
How many hours do you do, and how do you handle it on such contracts?
57 comments
[ 3.2 ms ] story [ 99.9 ms ] threadIf I'm programming 10++ I'll usually burn out after a month or so. Burn out usually means that I don't have the focus or will to get in a solid 8, more like 4 - 6, for a period while I reset (whatever it is that gets reset).
Bill based on the value you bring, not the time you spend heads-down.
I've read enough by @bdunn, @patio11, @tpacek et al to know that billing based on the value I bring is the best way to bill. Getting to a position where clients will consider it is... not happening though.
How do I break this blocker?
The other alternative is billing on a per-project basis; that gives you precisely no protection against clients wasting your time, or changing your mind, or any number of other things.
After 6-7 hours of programming, my code quality tends to dip dramatically, without me realizing.
With terrible impacts on the next day's productivity, of course.
Harder to do if your job involves only programming
It varies a lot with the amount of sleep I got the night before, which again varies a lot, having two small children :-)
https://news.ycombinator.com/item?id=7657502
The most popular answer was 2-4 hours.
Without sitting down and thinking I just don't have enough good ideas in my head which I could type in for 6 hours straight.
That being said, we do have a around 6h a week of Agile meetings. Usually split into 3 x 2h meetings. Depends on how each team wants to proceed.
Of course, if I have to attend meetings, talk to clients or work on the structure of a project, I'm not expected to do that in overtime. I cut in the 6 hours. But on a 7.5h shift, we are expected to spend 6 hours on average typing on the computer.
It's not like anybody is looking over my shoulder however. If you work faster by making pseudocode on paper before you start working, you would be allowed to.
But for freelancing I do quote 7-8 hours. I just program slower during that time, do easy tasks if any (css/html)
Not challenging you, just curious - how do you measure this?
Or comments like "are you chatting or are you working ? Why are you typing so fast".
My issue is that I sometimes jump into something too fast. I don't over think projects, and sometimes it leads to me making mistakes. But I am working on it.
This is almost never going to be solid programming time though, as you will need to communicate with the client, handle documentation and other tasks which legitimately take up part of the 8 hours. Also, you should take at least 1 or 2 breaks during the day which shouldn't be included in the 8 hours.
By the end of the day, you're not going to be programming as effectively as you were at the start. This is just the nature of working 8 hour days; the client won't expect you to be a machine. If you're really concerned about this, try to do all the difficult thinking and planning at the start of the day, leaving more straight-forward tasks for when you're tiring.
In short, say you'll work 8 hours and just do your best.
If I'm actively engaged with something, like a new algorithm, or the guts of a system, something really compelling and which is 'solvable', i.e., I've got everything nailed down enough that I can fit it into my head and start figuring out what bits are missing, I can achieve flow pretty easily and get maybe a solid 4 hours in that state, with another 4 hours taken up for less productive work getting into and out of that state, and for periodic breaks when I need them.
If it's defining the problem, exploratory coding to try and figure out how to interact with an external system (and that system is documented and sane), probably 3 in flow, with another 3-4 less productive; I'm nearly as productive as when I've got everything I need in my head, but I get drained faster.
If it's drudge work, or just hitting my head against a wall (anything trial and error-y, like interacting with something undocumented, stupid, inconsistent, painful, etc), perhaps 2 somewhat productive hours, over the course of 6 hours (the other 4 aren't productive -at all-), since every single thing will distract me, and after 6 I'm mentally exhausted.
EDIT: foz's comment x 100. Make it clear they're paying for exclusive rights to your time, not 8 hours of programming.
I tend to be more productive if I work at a client's office rather than my usual coworking space. I assume that's because of feeling pressured to look like a good freelancer, but it makes me enjoy work a lot less.
Same here - on those days I fly, I look like a genius.
Unfortunately, the next day I'm burned out, and the one day they paid me for turns out to have to cover 2 days.
I don't quote clients based on how long I think it will take, or how long I think I can work. I quote them based on the profit I want to make. And some clients, who have projects I don't want to do, get quoted ridiculous rates. It's been somewhat surprising to see how many have gone even for that.
I charge per-day, not per-hour. I sometimes evaluate quality of life issues around a per-hour basis, but I think the smallest unit of work-time is a day, not an hour, so I charge by the smallest unit. I find this makes me a lot more honest about my time accounting, as there is no temptation to pad time with goofing off.
In good condition I exactly say like jos82.
When in pain (I have a back neck pain killing me since 2 weeks and it seems related to my working position) It is unsustainbale to focus even on other tasks than programming for more than 5 hours a day and sometimes less (like 3).
When going into burn-in (like mbenjaminsmith, or Daishiman) I can focus up to 8-10h+ a day, the problem is the burn-out: Months with reduced concentration and almost a negative productivity in quality and quantity some days.
When in good physical and psychological condition, I focus the same amount of time, but quality of code is way better.
At home, the lack of noise and unwanted interruption increases the capacity of concentration and I can code 6 hours with better quality. The lack of social interaction however on a long run however erodes my pleasure of working, so I don't do it too often. (but it should also happen in good working environment or with good mental Daishiman or walshemj).
Stresses debilitates me, so I code way slower and with poor quality during a crunch unless I kick a burn in.
That is the reason I prefer a balanced solution.
It is kind of funny we have the same feedbacks.
I have a theory that the difference between 4-5 and 5-6 is the difference between a crowdy working environment and a quiet one.
Could some of you tell whether you work in a crowded or a calm place too? It would be fun if I was right.
What are 50 hour a week and up programming jobs like? Do you just tough it out and code endlessly?
I think that ambiguity kills programming production, and in this industry there are copious amounts of horror stories about poorly defined projects. And I don't think that documentation is some sort of mindless work break either, as someone above eluded to. Being able to effectively explain your code from a technical and/or functional standpoint also takes focus and energy.
Also, as clarification, documentation can indeed be mindless. "This REST API has changed and needs up to date documentation; let me go look at the code and find the new endpoints and write them down and what arguments they take" is a completely menial task.