Programming Marathons?
Mattygfunk asks: "Coming to the submission date of a major university project the other day, myself and another group member coded in XHTML/CSS and ASP (yuk!) for 27 hours straight to complete it. What is the longest Slashdot readers have coded in a single session? Apart from being more organized and having plenty of coffee, do you have any tips on getting through ultra-long coding sessions?"
At university, a few friends and I spent most of a week in a particular terminal room with no windows or natural light, without any sleep. We had left a six-month group project until the week before.
As I remember it (it's pretty hazy!) we washed Pro-Plus tablets down with a lot of coffee, Coke, Red Bull, etc. I think we were awake for over four days continuously. One of my friends finally went to sleep in an armchair in the common room opposite, just before the deadline. We failed to wake him, even by slapping him. Sometime during the last day, I started shouting rather than speaking, though I wasn't aware of it.
Believe it or not, we got a passing grade. I have absolutely no recollection of the quality of the code.
There's one strange phenomenon I experience after a lot of coding: it feels like my hands are connected directly to my shoulders, and my eyes seem to zoom in so the screen fills my vision. I code faster and better, but it's really weird. Does anyone else get this?
Bad for you. Let us not forget our Korean friend that died after playing EverQuest for 80 hours straight. Our human bodies are simply not made for that kind of exertion.
Given sufficient quantities of caffeine, humans working in shifts need only about three hours of sleep a day for 4-5 days.
Of course you were able to stay up for 27 hours. But if you had had 3 hours of sleep after the first 18, your next six would have been far more productive than the 9 hours you actually got to code.
Also, you'd be amazed how SMART taking a 3-hour break, with code swimming around your head, will make you.
I think if there's a team up continuously, hard at work on an exciting project, then 5-7 days of 3 hours a night ought to be doable.
Personally, I have done this (but without a team) on a few weekends, when I had very exciting code I was working on.
A semi-recent experience: came home friday (not this past one) and coded till 4 in the morning, fell asleep at the keyboard until the sun woke me seven-ish, saw my project on the screen (well, under the screensaver), so I got up, drank a bit of coffee, and sat down and coded continuously until the afternoon, ate something, coded more. I didn't have incentive to finish by monday and be really tired during the beginning of the week, so i went to bed around 9 and slept till 9 in the morning (thus friday and saturday averaged to 7.5 hours of sleep), but I know that I could have again gotten only a few hours of sleep and coded all of sunday as well.
I think that 48 minus 6 (for sleep) hours of continuous coding is about the extent someone can do without really really pushing herself or himself.
So, take-home lesson:
When people say that it really makes a difference to take a break from coding once in awhile, to get your head together and get a big picture of the project, maybe realize some of your mistakes while you still have time to change them, they mean it.
TAKE BREAKS, PEOPLE!!!!
At the very least, sleep 3 hours out of every twenty four.
(On the other hand, I believe that six-hour nights are sustainable indefinitely.)
I once worked 54 hours straight building sets for a play at my old high school. I went home, got 4 hours of sleep, cooked "breakfast" for all the people sleeping on the floor of my apartment, and went back for another 30+ hours to finish it (things got a little hazy towards the end there).
;-)
I didn't do caffeine at the time, either (I was one of those wacky straight-edge punks). Regular physical activity keeps the blood flowing and the limbs from cramping up or going to sleep. We also had a hot chick that brought us pizza every 6-12 hours, which is key
Under capitalism man exploits man. Under communism it's the other way around.
Cnn or something, a page updated with a short story every few hours. Whatever you do - DONT have slashdot, or any site where you can start typing (Forums, usenet etc). I am 1 1/2 hours into a coding session so far. I've opened one rxvt and typed "vi Lexer.java" - unimpressive.
Other tips I find help
You want to know the number-one tip for surviving a coding death-march? Don't start. Number two? Make sure you have competent coworkers who won't get you into a mess requiring a marathon session.
Story times, boys and girls, posted anonymously to protect the guilty. I work for a smallish company that, until March of 2000, employed the most self-conceited programmer I have ever met. He bragged about his skills to anyone and everyone--worse yet, he had a way of convincing other non-programmers that he was the god of code. Unfortunately, among the people he snowed was the boss, which would play itself out in a rather dramatic way. There were five others in the department, including myself, and while we couldn't stand him, we put up with him because he managed to produce reasonably good work on time. So when he bragged to the boss how good he was, we sighed and said nothing.
Our little company hit the jackpot when we got a juicy contract from another company in the aerospace business. They wanted what basically amounted to a sophisticated tracking system--in other words, given in-bound object X, calculate speed and trajectory, and extrapolate from a stinkin' huge database its probable identity and (from an even huger database) its probable targets. In other words, it was important to be able to distinguish say, between a passanger jet and a SCUD missle. The boss immediately assigns the code god to what he considers the toughest part: the extrapolation of identity and targets.
A couple of months go by, and we start noticing a disturbing trend. The god of code has submitted less and less code to the versioning system, until it drops to zero. He insists that he is hard at work, and just doesn't want to commit anything because, in his words, "It's too delicate at this point--I need to toughen it up before I'll feel comfortable commiting it." This is code, and not some greenhouse flower we are talking about. Nevertheless, he convinces the boss everything is fine. Time passes. We only have three days before our first demo date, and even the boss is beginning to have doubts. Finally, he approaches the code god and demands that he commit the code that he has written so that we can all start debugging the system for the demo. Nothin' doing. The boss calls him into his office. We hear their voices gradually rise, until suddenly things get very quiet.
I get called to the boss's office. Mr. code god is staring at the floor and doesn't look up. The boss tells me to take his computer out of the cubicle, along with any notes, papers, and files, and put it in the spare cubicle, where I am to review his code.
In five month, the guy had managed to produce a beautiful GUI for NT, something that wasn't even speced for, a complete API for querying the system (which was the last thing he submitted) and managed to write not one line of code for identification and extrapolation. Turns out that he couldn't figure out how to do it, and was too embarrassed to ask for help. Three days left to go before the first product demo, and the very heart of the project had not even been started.
We quickly decided that we would have to fake the demo. The sales guy, who was a really cool guy, explained how he thought we could salvage the demo. Basically, it was nothing more than a script. The system would correctly identify each object and spit out a list of possible targets because it was told, along with the telemetry data, what to say. To prevent the guys from snooping around too much, we took the GUI that Code God has made and "configured" it so that whenever anything was done outside of the scripted parameters, it would freeze up NT, requiring a reboot. I'm ashamed to say it, but it worked. The reviewers were very impressed with the GUI, and with how well the system responded to random data, but were disappointed to hear that there were still bugs in the frontend that needed resolving.
Then came the death march--one month filled with 120 hour weeks. During the final week, I got three hours of sleep. None of the other guys fared much better. But we delivered a working system that had a fantastic frontend.
As for Mr. Code God, we never heard from him again. But if you happen to suspect that you are using our program, you can easily find a little Easter Egg we put in at the last minute: create a new object, entitled "Code God" (Caps necessary) and with a range factor of 666. Leave all the other fields blank, and submit it. You'll see his image (I wish we could have photoshopped it) and some choice words. Don't worry about deleting the entry--it will delete itself once you click on the "Kill me now" button...
A few years back at Purdue, I was in EE365, the microprocessor design course for EE and CmpE undergrads. Through a terrible mishap involving rm and a misplaced whitespace character, our project directory (finished, and working with a few minor bugs) got wiped while trying to clean out some Mentor Graphics temp files. All the schematics, all the VHDL, all the whatever. *poof* One week to go.
Now, there were plenty of workstations available-- many more than there were teams working in the class. Unfortunately, most of them were old 50MHz machines. Not quite enough to do the simulations in a timely fashion. As in, not quite enough to get *any* of them done in a week.
There were, however, 6 or 8 HP VISE workstations that just screamed. Obviously, in high demand. So, my partner and I waited until one opened at 3 in the morning, and proceeded to camp it out for an entire week. We took shifts, brought eachother food, and covered eachothers' classes. The last two days we were there straight through.
I have never been more tired in my life, but we got it done.
My advice? Don't do it. Make backups. If, like us, making a backup would be bigger than your disk quota and took too long to send home via a modem-- MAKE THEM RAISE YOUR QUOTA.
My longest marathon was 40 hours at work. I arrived at 8am on Wed and left at 11:30pm on Thursday. However, it wasn't 40 hours straight in front of the screen; our build and test process (that we run frequently) took 15 mins at the time so I and my teammate would take foosball breaks every so often. And then when I fell asleep while waiting for JBuilder to reach a breakpoint, I decided it was time for a nap. Slept for two hours (this was Thurs afternoon, after I'd already worked for 30 hours) and then went back at it.
:)
We got the code checked in, working and unit tested by the midnight Thursday deadline. All in all, that week was over 80 hours long, in 5 days.
As for the quality of the code, it wasn't GREAT, but it wasn't too crappy either. All in all, not too bad an experience. I was even able to go down to the gym in the morning and take a shower, to help refresh the ol' brain cells.
And during my 4th year in University, I pulled probably 30 all-nighters, which typically involved a full day of class, then a one hour commute home, then work all night, then commute back to school, then class all day. I was glad to leave the stressful school world and return to the easy 80 hour weeks of the working world
I started my procrastinating career and thus all nighter practice way back in high school. But it wasn't until I saw coverage of the 1986 Race Across America that I saw what is truely required for a multi day push. The RAAM is a bike race starting on the West Coast of America and finishing on the East Coast. Unlike most other races this one isn't broken into stages. It's simply a matter of who can get there first. In 1986 a man named Pete Penseyres set the average speed record which appears to stand today. His secret was sleep management. He had someone observe him while he slept for some time before the race to determine when he would typically experience REM sleep. Then during the race, his support team would pull him off his bike, lay him down in the support van, and let him sleep until his eyes stopped moving. Then they put him on his bike and sent him off for another day of riding. The net result was obviously favorable. He had competition that was actually faster but nobody was as consistent. Those who would have beat him almost always crashed while hallucinating from lack of REM sleep. So those here who are preaching the "3 hour break", I think are on to something.
Once in 1999, when I took six months off, I started around 8 am and stopped coding at 8 am next day.
:-)
When I was 24 I used to do a lot of 100 hr weeks; once after my third 16 hour workday I had a "panic attack"; it felt like a stroke; left side numb; couldn't move left arm; felt like I couldn't breath. I basically learned at that point working craploads of hours doesn't mean you're a hero; it actually means you're an inefficient person who cannot complete their job in a normal 40 hour week.
If you want to earn some REAL geek cred, learn how to do what you do in a normal 8 hour day. Trust me, it's far more rewarding to be efficient. Plus it's just so cool to be done with your shit by 5pm while everybody else is there all night
BTW I recommend taking six months off if you ever can. I just paid my rent in advanced, coded, fished, and went to bars. I was broke as hell by the end of it, but I wouldn't trade that experience for nothing.