I can get anywhere from 3 to 6 hours of useful programming in a day and a couple times a year I might do 10 hours. I am far more productive at an average of 4 hours of work per day than trying to do 8 or 9 hours. I've worked with people I considered far smarter than myself and I can match or beat them by putting in a third of their hours working on similar problems.
Just this week, I did an estimated 2 weeks of work in about 14 hours over 3 days, most of it staring at a whiteboard. All of the code was written in 2 three hour sessions on the final day. I frequently do things an order or two of magnitude faster and smarter when I'm well rested and relaxed.
I don't mean to brag. It really bothers me I come in to the office just before the daily standup, work for 6 hours and leave before anyone else. (I usually spend an hour or two doing non-programming tasks each day)
I can definitely say "work smarter, not harder" is really effective for me. I don't know if it's true for everyone but I suspect it is.
It became culturally ingrained because, back at the peak of labour-intensive industrialization, about 50% of the work force were employed in factories. But it doesn't actually bear any relation to how much time we can spend working effectively in tasks that require high-level reasoning skills. Nor does it bear any relationship to the earlier pre-industrial paradigm (agricultural labour from dawn 'til near-dusk, which could vary from 6 to 18 hours per day depending on the length of the day -- indoor lighting consisting of [expensive] candles).
Unfortunately it's also easy to see whether a body is physically present or absent from an office -- easier than measuring the quality of its mental outputs -- and it's still relevant to service occupations, which is why we're mostly stuck with it.
I don't think you should be bothered... I've seen the 'about six hours' of productive coding figure come up multiple times when teams actually experiment with their hours worked and their productivity. I suspect that your co-workers would be more productive if they had the same work pattern you do.
I can definitely say "work smarter, not harder" is really effective for me. I don't know if it's true for everyone but I suspect it is.
I'm pretty darn sure of it myself. Every team I've worked on that's been doing more than 45 hours a week has got more productive by cutting hours worked.
Rather than staying up until 1am in an awe inspiring hacking session to get the latest release running, I'd much rather people went home at 5pm so they were on the ball enough not to write the damn bugs in the first place.
I realise this post will be ridiculous to many people reading this, for whom 37.5 hours is still half-time.
(If it's any consolation, I was also not getting noticeably more done in my free time when I had more of it.)
I can and have pulled all nighters. I probably still can. It's just that I've learned that doing so, or spending more than about 30-35 hours a week coding, makes me slower - not faster - overall. Even, and I can't emphasise this point enough, if I feel completely fine doing those extra hours. People are really bad at introspecting on their own productivity.
Figure out some metrics for productivity. Try cutting the time spent in front of the keyboard for a few weeks. Measure. You may be surprised.
Programming is much the same way. Use your best hours to refine/polish work that is furthest down the line, use your worst hours to write crap that gets you started thinking about what the real solution will look like. Even in your best hours, you probably aren't going to come up with the right solution immediately (unless the problem is easy).
Limits, folks: we have them. Learn and respect them and don't try to be macho about it, because it doesn't help.