How many minutes/hours do you really sit to write code at a particular moment?

I'm not saying the total summation of hours you code a day. When you really sit down to write a code for a particular task at a moment, how many minutes/hours (at worst case) do you normally sit down before you get tired? I know some take break, some say it depends on the task or the individual, I would love to hear them all, and what you do to keep your brain refreshed before getting back to coding. Thanks...

Write your answer…

9 answers

That's a great question!

I used to work in-office either as an employee or as a contractor, and I would regularly sit for 4 hours at a time bashing away at the keyboard, with small moments where I get up to get a drink or go to the bathroom, but I'd consider my 'session' length as half a day, split by lunch.

Then when I began freelancing I think It would get even longer. Sometimes I would work through the night, sometimes I could challenge myself and take a 12-hour block and see how much I could get done, so I know sometimes I was sitting doing the same thing for 4+ hours, maybe even double that regularly. But that's not healthy or sustainable.

I think now I spend a lot more time working, but I have much shorter sessions - 15 minutes, 30 minutes, 40 minutes, and hour or two. But rarely do I have a 'session' of work longer than 3 hours without being split up either by travelling, doing chores or running errands, meals, etc. And I feel more productive (overall) than when I used to sit and work for longer sessions.

My personal theory is that creativity is like a well full of water, and it replenishes slowly when you are inspired. So if you're building and creating things that takes energy out of you, and it takes time for you to recover before you can do that again. When I was doing those long sessions it felt like I was super productive, but I wasn't super productive like that every day, especially not after a big day.

Get up, move around every now and then, and try to let your work sessions be punctuated by little breaks so you can keep agood momentum overall :D

Show all replies

Try established productivity techniques like Pomodoro, they feature working intensely and in a focused manner with breaks after each focused stretch...

Reply to this…

Hashnode is a friendly and inclusive dev community.
Come jump on the bandwagon!

  • 💬 Ask programming questions without being judged

  • 🧠 Stay in the loop and grow your knowledge

  • 🍕 More than 500K developers share programming wisdom here

  • ❤️ Support the growing dev community!

Create my profile

If you mean absolutely no breaks whatsoever as one session, then on average probably 30 min to 1 hour. If in the flow, sometimes longer. Usually small breaks can be good also, especially when nature calls or coffee cup is empty.

I tend to get a cup of tea every hour lol.

Reply to this…

Depend on Bug. ;) XD

Reply to this…

I divide my time in a natural way. Your coding project is always a stack of short classes/elements/parts/scripts/features/task/... so everytime I completed a specific part I at least stand up to grab a glass of water.

Most of the time these moments are the same moments I commit changes to git, because a new feature is implemented. And most of the time these moments take anything in between10 minutes and one hour.

Reply to this…

Maximum of three hours. I usually spend a lot of time preparing, reading, and planning. After completely understanding what needs to be done, I start writing code. Before starting my day, I think about what needs to be done today. Then after exercising, refreshing, eating breakfast, I start preparing for the project. At 12:00 pm I start writing code and after lunch, I take a nap. A power nap makes me refreshed but I don't write code afterward. I just read and write till dinner.

Very interesting. Thanks.

Reply to this…

Load more responses