I have to finish a side project this weekend and am planning to code for 10-20 hours at one stretch. Is it a good idea? Have you done something similar? Any tips or tricks that you can offer?
Thanks guys!
I like to relocated during long stints. It gets the blood pumping and gives your eyes/fingers a break. This usually consists of walking to a different coffee shop after an hour or two.
The longest I've worked at one stretch was 7 days, only taking bathroom breaks and food breaks twice a day (teeth brushing breaks after food breaks) only partially napping for 15 minutes while waiting for my food order. (there was no shower at the lab, so I only hopped into clean clothes every day). At day two I was working like a maniac, day three I was back the same productivity level as day one, day four time started to go faster and slower at the same time and I started to have mild hallucinations from lack of sleep, day five and six I couldn't remember much of, time was leaping and there was code in my code-base that I don't remember writing, code that worked, but I don't remember writing it. I started losing the ability to speak unless I spoke very slowly. Day seven, I handed in two projects (I've finished several months' work in just seven days, not because I was slacking, varsity workload was just insane, I only had 7 days of the 3 months to finish it or otherwise repeat the subject)
... the world was moving in slow-motion, cars seems like they are standing still and then re-appearing in other places. I would have blackouts for a second or two according to my watch and have lucid dreams in those few seconds of being semi-unconscious, but those lucid dreams would feel like half a day and often times I would solve very complicated problems during those lucid dreams and struggle to remember all of it. It was Monday 8 am, I'm sitting in my first class of the day after hardly getting any sleep since the previous Monday, the professor would ask me questions, I would black out for a second and then somehow manage to answer him a second later that feels like 6 hours has passed. I finally got 8 hours of sleep that night following that 7 day work-marathon and then I had to switch to Uberman Sleep in order to slowly get back into normal sleep mode again, the next 6 months was mostly working 1-3 days at a time surviving on 15-30 min naps and having one 8 hour sleep night twice a week until I eventually started moving back to 2-4 hours sleep a day.
Certain things can be done in one long stretch (repetitive work or work that doesn't require much thought depending on your skill level and what you would consider deep thought), anything that requires insight and deep thought - after a very long stretch, your brain is pretty much shot and you'll start seeing errors creep into your work. You need to decide how much errors you can tolerate before the quality of your work starts to suffer. Sometimes going to insane lengths to get a project done is needed, sometimes the mess you make is not worth it.
I agree with @sidhantpanda: the long sprints happen when you get really into code and you are on a roll and you lose track of time because you are really enjoying it. I usually don't even need to eat. Decaf if you are scared of caffeine rushes. Planning short stints with short breaks and naps are all good and well, but it takes some discipline. The nap thing never works for me... But I would usually only need nap time after about five or six hrs of heavy going, and by then, it would probably have been better to just have five or six hours of sleep and then get up, have a cold shower and be fresh for the next five or six hours of work. Don't make a habit out of it... It catches up with you eventually
If you are planning to do it once... is not a problem, but I don't advise it to constantly do it. ANY work where you apply too many hours in a row... can cause problems, not just for your health, but also for your project. Our bodies, especially our brains are not design for that amount of "stress", "pressure".
I would advise to stop maximum every our... stretch your legs... eat something, drink water, and most important of all... try to look at something that is far way, this prevents problems with your eyes (making it break the flow of looking at something that is really close).
Again I don't advise this in any way, and I speak from personal experience. Spending time without sleep (coding or doing something else) can cause big problems in your brain ( specially related to memory)
Hope you finish project.
If there's any way you can help it I'd avoid very long stretches -- at a certain point you begin working against yourself, and create more bugs and problems than a solid solution. Of course if you need it done, you need it done, and it can't always be avoided especially in an early stage startup when you're starving for resources/time/cash, but if you want to become a sustainable business and predictably better programmer, quoting out and allocating the proper amount of time when planning the project is well worth it.
Of the times I've done many of these long coding stretches (and that is many, many times), I paid for it later physically (illnesses/burnout), and often the code ended up having to be completely replaced or significantly repaired later -- even more time is burned in the fixing than in the initial creation.
In my mind these days, long stretch coding is what builds technical debt. Something you code in smaller chunks ends up being more inherently understandable as you are forced to leave and return and each time and be able to pick up and understand what has been done and what needs doing. When you do a long stretch, it's all in your head, and that means that when you come back to fix it you might need a long stretch just to have enough time to understand what you even did.
Hope that helps!
I should not recommend that. First of all, it comes a time where you are just making noob mistakes on your code and don't know where you're blowing it, after 6 or 8 hrs of work. I do recommend you to take breaks you could do the 25 minutes of work and 5 minutes of rest; and after a lot of hours increment your breaks to 15 minutes. Go outside to eat, distract yourself and don't eat a lot of sugar or bread, eat healthy to last longer. And for god sake don't skip sleep hours, take a nap or your whole 8hrs.
I have done a couple 6 or 8 hour stretches but I didn't know it till after I was done. In one day the most I would say was 16 hours.
Well, it's a bad idea in general, but you can make it less bad. Couple of tips:
If you can't avoid sleep, have a coffee, and then take a 20 - 30 minute powernap. The nap will free receptors for the caffeine to attach to, so it'll work better after you wake up.
Don't put a timer. Don't force yourself to code for 10-20 hours. These long sprints happen when you get into your groove and don't even think about how much time you spent.
If it's something you don't really want to do, it'll just be torture to force yourself to complete it. If you already have something interesting enough, you will finish it without putting in much thought.
This only works for side projects, you need lot of coffee for work ;)
Robert Gerald Porter
Co-founder & CIO @ Weever Apps || Digital Naturalist
Hasan
Software Engineer
Not sure I registered hours, but have coded for few days straight, only sleep and food in between lol