I do the same thing, 30 minute stints, 3-5 minute breaks. Occasionally if I'm really rolling I'll just keep going but I generally make sure to stop for breaks.
The key is to do things that won't get you mentally distracted, has a good stopping point, and lets you mentally rest.
Good breaks:
- I walk around the building
- Watch a short comedy youtube video
- Scroll through memes/comics
- Read blog posts, usually ones that aren't too detail-oriented and with good stopping points (Coding Horror is a good example)
- Listen to an instrumental music song (no lyrics), close my eyes, maybe get some fresh air.
Bad breaks:
- Start a long email
- Other projects.
- Anything mentally taxing or stressful (don't pay bills on break, don't try to figure out what you'll have for dinner)
- Read an exciting book that you don't want to put down
Doing this helps me stay focused all day. Over an 8 hour shift I take breaks for approx 48-80 minutes (plus lunch), so at most a little over an hour is wasted--versus burning out after just a few hours, writing bad code that I then spend the next day cleaning up.
This further translates into me being able to work some more on some side projects when I get home without getting burnt out--and not always programming, but other mental work like writing, art, meal planning, etc.
Good breaks:
- I walk around the building
- Watch a short comedy youtube video
- Scroll through memes/comics
- Read blog posts, usually ones that aren't too detail-oriented and with good stopping points (Coding Horror is a good example)
- Listen to an instrumental music song (no lyrics), close my eyes, maybe get some fresh air.
Bad breaks:
- Start a long email
- Other projects.
- Anything mentally taxing or stressful (don't pay bills on break, don't try to figure out what you'll have for dinner)
- Read an exciting book that you don't want to put down
Doing this helps me stay focused all day. Over an 8 hour shift I take breaks for approx 48-80 minutes (plus lunch), so at most a little over an hour is wasted--versus burning out after just a few hours, writing bad code that I then spend the next day cleaning up.
This further translates into me being able to work some more on some side projects when I get home without getting burnt out--and not always programming, but other mental work like writing, art, meal planning, etc.