Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Programming Warm Ups? 84

ResHippie asks: "No athlete or musician would think about just diving in to the day's activity without doing some series of warm ups first. Aside from starting most computing sessions with checking email and the like, I pretty much try to dive right in to the task at hand. It usually takes me a while to get going, though. Does anyone have any routines they go through before coding (or any other work-like activity) that helps?"
This discussion has been archived. No new comments can be posted.

Programming Warm Ups?

Comments Filter:
  • coffee (Score:5, Informative)

    by Hubert_Shrump ( 256081 ) <{moc.liamg} {ta} {tenarboc}> on Friday July 25, 2003 @06:19PM (#6536046) Journal
    coffee, a little slashdot... poking at any outstanding errors, reading through error logs from the program in question... rereading the source, adding better comments to sections that you've forgotten /again/ how they work... write a little documentation, update the changelogs...

    THEN the new code.

    • Funny? It looks like very good advice.
      • funny? (Score:3, Funny)

        I am staring at my hands thinking: but that's what I actually do... Maybe I should have gone to college where they teach proper technique...

        Then again, taking a break from coding and reading the other replies: everyone else seems to be answering humorously, so maybe I can save my ego by saying:

        of course I don't really do any of that, heh heh... that would be silly... I mean, coding is hard and I... Hey - look over there - the Matrix!!

    • Re:coffee (Score:5, Funny)

      by compwizrd ( 166184 ) on Saturday July 26, 2003 @12:42AM (#6538172)
      and by that time, it's time to go home!
  • Load Slashdot...
    • Re:The Obvious (Score:4, Insightful)

      by Glonoinha ( 587375 ) on Saturday July 26, 2003 @07:41PM (#6542047) Journal
      Actually, the obvious (if I want to get some serious work done) is to NOT load /.

      My routine when I really, really need to bust out some hardcore code is :
      Get caffeine in my system. A big glass of ice tea consumed while I am fixing myself the second, bigger glass that I will drink on at the keyboard.
      Fire up the computer.
      While that is firing up, rinse my face in the bathroom sink, hot water - really hot. As my face warms up, make it hotter. With the face oils on my hands, run them under water that is as hot as I can stand without pulling them out. Two or three minutes between face and hands.
      Log into my system.
      Put in my ear plugs.

      (Here is the important part) ... open some code, any code, in the editor and hit compile. Watch it compile while I sip some tea, and when it finishes compiling start looking through the code for something to document. I don't need to actually change any code, just get my brain in code reading mode and commenting some uncommented code does this for me, not to mention gets the code documented.

      Don't start a browser session.
      Don't open my email client.
      Don't sign in to instant messenger.
      Don't check voicemail.
      Don't start the Kazaa client.

      No slashdot, no hotmail, no work related emails, no fark.com, no cnn.com, no tom's hardware, no ebay, no techbargains ... no nothing. Just me, the compiler and editor IDE, and the task at hand.

      If you follow that formula, the inertia will be to get into the zone and stay in the zone (no distractions via phone, email, IM, whatever.) In fact if success isn't optional, I have been known to unplug my machine from the network, insuring that I couldn't fire up and of the distractions 'just for a second' even if so inclined. Get some serious work done, though.
      • In fact if success isn't optional, I have been known to unplug my machine from the network, insuring that I couldn't fire up and of the distractions 'just for a second' even if so inclined.

        success is never optional.
      • I think that if you used vi instead of a full-blown distraction-incurring IDE it would be even better. I mean how many times have you read every help page?
  • Check some web sites (Score:3, Interesting)

    by SoCalChris ( 573049 ) on Friday July 25, 2003 @06:20PM (#6536054) Journal
    I always scan through the new articles here on /. and Fark.com [fark.com] before starting the day. It sort of gets me thinking a little, and starts the day off interesting.
  • The usual (Score:5, Insightful)

    by adamy ( 78406 ) on Friday July 25, 2003 @06:20PM (#6536055) Homepage Journal
    Drink Coffee
    Read Email
    Read Slashdot

    Actually, the best way I've found to get into the zone is to leave a compiltation error from the previous day. It is the mental equivalent of a stack pointer from which you can pop all of your registers, reinitialize the idle process, and start cranking.

    example //Working here, trying to get the right objects from iterator
    BadObject b = iterator.next();

    Yes, I work in Java. Compiler will shout about bad object types, and I'm off.

    • 1. Drink Coffee
      2. Read Email
      3. Read Slashdot
      4. ...
      5. Profit!
    • I'm not a programmer, so please don't flame me if I'm off-base here.

      Isn't this a rather bad idea? What if you add something and somehow miss what you added, killing 30 minutes of your day tracking down the problem? What if something else goes wrong somehow? (Strange shit happens, says the Mikey-San, half-1337 IT worker.)
      • Well, Worst cas is it is something you can remove and continue the compile. My builds are minimal so it isn't a problem here.

    • Actually, the best way I've found to get into the zone is to leave a compiltation error from the previous day. It is the mental equivalent of a stack pointer from which you can pop all of your registers, reinitialize the idle process, and start cranking.

      I do that too; I put an XXX at any unfinished bits. It's visible, and you can search for it.
  • Warm-Ups? (Score:5, Funny)

    by chemstar ( 457943 ) on Friday July 25, 2003 @06:20PM (#6536056) Homepage


    I don't know, five years at a University?
  • My routine (Score:3, Funny)

    by OiBoy ( 22100 ) <{gro.syahseht} {ta} {belac}> on Friday July 25, 2003 @06:20PM (#6536057)
    I work at home, and the work day starts at 0900, so this is my routine:

    0830: alarm goes off
    0840: actually get out of bed
    0842: start brewing coffee
    0844: pour cup of coffee before it's actually ready
    0845 (optional): small scream as I pour hot coffee on my hands since I haven't opened my eyes yet
    0846: go out on deck with copy of whatever magazine is closest to hand (generally some ancient copy of Linux Journal). Smoke cigarette, drink coffee
    0859: come back in
    0900: log onto computer and check for emails from co-workers
    0901: quick scan through various mailing lists for security alerts and the like
    0903: try to remember what I was working on yesterday when I called it a day and get back onto it
    • 0844: pour cup of coffee before it's actually ready

      Depending on your coffee maker, I discovered a trick to saving time with this...

      Have your cup ready, with milk and sugar (or whatever you use in your coffee, personally I like a single ice-cube so I don't need to wait for it to cool) already in it.

      Fill the pot with water, and place the coffee in the brewing basket.

      Place your cup under the brewing basket, and dump the water into the appropriate spot on your machine.

      Poof, instant cup of coffee. Ju
  • Kick on the mp3 player, stretch out the hands (RMI), check the mail, update the source, check for user posts, drink the coffee, kill the lights, crank the music, and let the code begin.....
  • by GuyMannDude ( 574364 ) on Friday July 25, 2003 @06:23PM (#6536093) Journal

    I usually start the day's coding session with a slow progression of vocal cord exercises that simulate what will be done later in the day.

    Start with simple cursing. "Dammit. I can't believe I left that variable uninitialized." Then gradually build your way up to more intense grumbling, being careful not to overstrain your vocal cords. "Holy crap that goddamn idiot Jack still didn't fix that bug? That was a week ago! What does that fat sack of shit do all day long?" From loud complaining you work your way into loud yelling and screaming. "Fuck you, MSVC++! Don't tell me 'internal compiler error'! What the fuck kind of shit is this! You goddamn cocksucker! Fuck you Gates! Yeah, fuck you!" Now that your blood temperature has raised a few degrees, you can begin doing whole-body exercises. Jump up and down and scream "Fuck! Fuck! Fuck! There's no error there you shithead compiler! That's perfectly legal C++! Just compile it you fuck!" Then pick up your monitor and pretend to throw it against the wall. Start gradually at first, eventually working into really whipping your torso around. This will make sure you down strain any ligaments in your lower back when you finally do snap and start trashing your computer.

    Remember people, safety first!

    GMD

  • Speed (Score:1, Interesting)

    by spoonist ( 32012 )

    Lots and lots of methamphetamine.

    'nuf said.

  • Space out (Score:5, Funny)

    by fredrikj ( 629833 ) on Friday July 25, 2003 @06:39PM (#6536305) Homepage
    Obligatory Office Space quote [imdb.com]:

    Bob Slydell: If you would, would you walk us through a typical day, for you?

    Peter Gibbons: Yeah.

    Bob Slydell: Great.

    Peter Gibbons: Well, I generally come in at least fifteen minutes late, ah, I use the side door--that way Lumbergh can't see me, heh--after that I sorta space out for an hour.

    Bob Porter: Da-uh? Space out?

    Peter Gibbons: Yeah, I just stare at my desk, but it looks like I'm working. I do that for probably another hour after lunch too, I'd say in a given week I probably only do about fifteen minutes of real, actual, work.
  • by GuyMannDude ( 574364 ) on Friday July 25, 2003 @06:53PM (#6536461) Journal

    Make sure to do exercises for each part of your body:

    • Fingers: They do a lot of work during the day so you need to make sure they can handle the stress. Start typing gibberish at a gradually faster pace until you drive the guys in the nearby cubicles nuts with your key-clacking.
    • Eyes: You will be staring at code for long hours. Start by visiting your favorite pornography site. Stare at a hot picture, unblinking, for several minutes. Repeat with a new picture over and over again until your eyes begin to get tired.
    • Mouth: Your jaws will get fatigued during an entire day of sitting and snacking. Warm up by chewing on a sock for 30 seconds. Rest. Then try for 60 seconds. Remember to use a brand new sock for each day -- resist the temptation to use the same chew-sock for each morning's warmups.
    • Lungs: Breathing is very important. Sigh louder and louder over and over again until your coworkers tell you to knock that shit off and get to work.
    • Butt: It will get tired of supporting your ponderous bulk in your chair for hours on end. Stand up and plop yourself down in your chair repeatedly. Stop when you get bored or if your chair breaks, whichever comes first.

    Hope that helps,
    GMD

  • I like to leave the day off with a test that fails...

    Then, the next morning... I run a "make test"

    Fixing the failed test usually gets me back into the flow. If not, I write more tests.

    If that doesn't get the juices flowing... I write docs and refactor code.
  • Python (Score:5, Interesting)

    by Apreche ( 239272 ) on Friday July 25, 2003 @07:03PM (#6536563) Homepage Journal
    I usually open up the interactive python session and try a couple things out. It's not really a warm up, I'm trying to learn python. I guess it could be though. Try a few lines of code out, then get down to business.
  • I figure when my pulse reaches 140 BPM at rest my brain is getting enough blood to acheive it's full potential.
  • When I am writing code [freshmeat.net] I like to use the product for a while and get the feel of what is going on and visualise all the functions that get called while it is executing. Its imprtant to get a vey basic version of the system going to get the idea of how its executimg. Thesame goes for hardware design. When I was designing a cpu it really helped to see the schematic view of the system executing instructions and the values flying around. Much easier to understand than looking through the design.
    When writing a l
  • Advice for writers (Score:5, Informative)

    by DrCode ( 95839 ) on Friday July 25, 2003 @07:24PM (#6536712)
    This is similar to some advice I heard for writers:

    When you're being really productive towards the end of the day, stop before you're finished. Then you'll have something easy to start with at the beginning of the next day.
    • I'm not sure this is a good idea. Since finishing it at the end would be faster than doing it first thing in the morning. Plus if you finish it wou'll be able to think about the next task overnight and maybe come in the morning ready for it. I don't know, I just don't see how that could make one more productive. I will try it sometime.
    • by mr3038 ( 121693 )

      When you're being really productive towards the end of the day, stop before you're finished. Then you'll have something easy to start with at the beginning of the next day.

      I think it's usually easier to code one block (a complex method, a class or something else) to finish if I have time. If you've trouble getting on the right track the next morning, I'd suggest code reviewing previous day's changes. Do a diff -u and think why you did write that code yesterday. If you cannot figure out, then there must be

    • Perhaps, but if you're (finally) in Deep Hack Mode, you shouldn't stop - I reckon.

      z
      • Of course not!

        If one's in HE-MAN 48-hour Programming-Blitz(tm), then stopping means losing some of that perfect code, right?

        -shudder-

        sorry, I couldn't resist that, but the concept is actually getting-at the difference between a good session and a good continuum, and the good continuum is more, long-term productive than are a couple of good sessions.

        Some can easily work that way, some can't, though, and some won't validly try that, so..

        Also, Deep Hack Mode doesn't stop being productive just because

  • First thing: always check out the error logs from the sun servers(emailed to me every morning). Get my coffee...read slashdot....there goes an hour. by the time i'm done reading...reload and there is a few new articles...another 20 minutes gone. then start with a new compile to see all the problems from the previous day.
  • I find that opening the bug list and simply pick one and start then is MUCH more productive than reading any e-mail or web sites first thing in the morning. I still grab a coke first thing, but have found that if I read e-mail or any other tak first thing, when my head is somewhat clear, I am MUCH more efficient, and can usually get on a roll easier and have most of my work completed before lunch. It feels good to have a somewhat clear concience. In addition to this method I have found I can think much bett
  • Step 1: Locate Caffiene source. Step 2: Devour at least 24Oz of source to initiate step 3 Step 3: Get your jivin' tunes in order, crank-em up; Techno makes you feel smart and gooooood. Step 4: Drink while coding, keep a good supply of moozic on hand so you dont listen to the same stuff.. Step 5: collapse for the night and sleep Step 6: wake up and repeat!
    • the only problem I have with techno anymore, is that it is very hard for me to find a) something I havn't heard a million times befor or b) something that dosn't sing about sex0ring/other planets and general raver extasy feelings of the sort. I mean, I don't want to be blaring music about some bitch going off to another word sex0ring your best friend.
      • haha; http://www.modplug.com amateur techno, no crap; most is without words, there are some funky filetypes they use tho, but they have a fairshare of MP3's too. If you have WinAmp, that will read any file on that site.
  • by mbstone ( 457308 ) on Saturday July 26, 2003 @01:28AM (#6538300)
    One time Hunter S. Thompson was lecturing at my college campus (with John Belushi!) and I had the opportunity to ask him about his preferred method of preparation for a writing session.

    Thompson's complete answer: "Booze and speed."
  • Just don't stop... seriously... When I'm on a roll, I don't stop for anything. Just give me an IV and some caffine. I stop when the program is done- or my blood sugar level drops below 10.
  • I find that starting with paper and ink is a good way to get the juices flowing. If you have a bug from a previous day write out a solution on paper, nothing serious, just jot down some notes on it, or ideas.

    If you don't have something specific then I generally do as someone else mentioned and test a few things; if I find there's something broken put it on paper.

    For me there's just something about flowing ink and flowing ideas. Overall I think finding small issues (if lucky) to work on at first is good

  • Exercise (Score:5, Insightful)

    by LadyLucky ( 546115 ) on Saturday July 26, 2003 @03:50AM (#6538609) Homepage
    OK, so maybe I'm lucky and I have a work subsidized gym membership at the gym which is on the otherside of the carpark, but I find there's nothing quite like a bit of exercise (swimming is my cardio of choice) to get the blood pumping, gives you some alone time in the zone to toss around those ideas for sexy code.

    That, or coffee.

    • arrive @ 8.30
    • delete spam
    • read emails and logs
    • check seti@home proxy status
    • check computer mags, blogs (William Gibson [williamgibsonbooks.com]], Joel [joelonsoftware.com]) and slashdot
    • 9.00 ready to code & debug
  • Kata (Score:3, Informative)

    by darkpurpleblob ( 180550 ) on Saturday July 26, 2003 @07:16AM (#6538997)
    Have a look at CodeKata [pragprog.com], coding practice sessions. Doing one of these occasionally (start of each week?) may help you get into the right frame of mind/attitude.
  • by pz ( 113803 ) on Saturday July 26, 2003 @11:29AM (#6539691) Journal
    To start a serious coding stretch, I take care of outstanding things that will be a distraction. Like, as many others have suggested, reading email, Slashdot, checking whatever web pages your mind might drift to, chatting with co-workers and boss, using the bathroom, eating lunch, etc. Then, make a cup of coffee, turn off telephone, select appropriate music, put on headphones, and start cranking.

    If you can't leave your development tools in a specific state between coding sessions (ie, if you are required to or prefer to shut down compilers, editors, IDEs, and the like when not in use), then, as others have suggested, leave a syntactical error at a key location which will clue you in to where you were mentally (this is not so much warm up as a token to make the process faster next time around). Even if you don't shut your tools down, it's nice to have a quick description of what you were working on before to continue from. I often will write down a couple of key phrases on a piece of paper or yellow sticky (eg, "check interaction between reduncancy check and precomputation" or "examine compute_latency() output to be sure each event is valid") left on my keyboard.

    Now, to really answer the question, I don't think anyone does any mental exercises to warm up. I also don't think they're necessary -- most of the posted answers, including mine, deal with preparing your environment for work, not yourself. The most common exception to this is ingesting caffeine -- and this is well-known to initially have a sharpening effect on cognitive ability. The most difficult part of doing hard coding is recovering the mental state, and while not exactly preparation for coding, it's the biggest step when resuming an earlier coding session, and many other posters have given good tips.
    • Damn, it must be nice to be able to get "talking with the boss" out of the way. I have this problem that mine comes over every hour to ask "how's it going?". Usually when I can least afford the distraction.
  • Logic game (Score:4, Interesting)

    by Lord Grey ( 463613 ) on Saturday July 26, 2003 @03:00PM (#6540742)
    My own programming "warm up" isn't much like most of the posts here (reading email, Slashdot, etc.). I do those things every morning, sure, but I don't consider them some kind of warm up for a coding session.

    Instead, I load up the project, create remote sessions, etc. -- whatever I need to do the job -- take a look at the specific thing I need to work on, then background the whole thing and bring up some kind of logic game. Lately, it's been Bejeweled Deluxe.

    I've discovered that a logic game puts me into the right frame of mind while simultaneously letting me "mull over" the work I'm about to do. I stay away from reflex-oriented games, or those involving words; they make me concentrate too closely on the game. By the time I've played a game or two I've already thought of several ways to attack the coding problem at hand, and I can get started.

  • apt-get install typespeed and I play a game or two. Gets my fingers going, and ready to type for the rest of the day. Nothing is more annoying than trying to type and solve the world's problems when you have fat fingers in the morning.

    --Robert
  • jack off once or twice to get me going.
  • Think. Read. Eat. (Score:3, Interesting)

    by zedeler ( 671724 ) on Sunday July 27, 2003 @09:51AM (#6544005)

    Before programming, thinking has a proven effect on the outcome of your endavour. I have programmed computers for about half my life (started at 15 and turned 31 last year), and thinking seems paramount when considering what to do before actually coding. It is amazing to see how many forget this basic rule of thumb [google.com].

    Next, read books [amazon.com] and standards [ietf.org] . Not knowing that your problem has been (partly) solved already or can be solved better is a sure path to theeth-grinding reinventions of the wheel.

    Then, when you're really set to start coding (after thinking for half a day, reading a book and three standards), eat. Real food.

  • I do 1 hour of excercise before coding showering and getting down to code. It adjusts my attitude, focusses my mind, reduces my bug count. Wonderful.

    Oh, yeah, I keep a large cup of coffee and a larger bottle of water next to me while I excercise.

    I usually do my stretches first, then weapon practise in the backyard, then go through all my katas and sparring techniques....

    Kung fu does wonderful things for the mind and body. All the physical and mental value of Yoga but about 10 times more fun.

    Stonewolf
  • When I find myself slow in the morning, it is usually because I am not exactly sure what it is that I am supposed to be doing. My solution has been to plan the next day, particularly the first tasks, before leaving at the end of the previous day. The other approach is not to worry about being slow in the morning. If fact, you may want to skip the mornings altogether on the basis that productivity is particularly low at that time.
  • When a CS project is due this tends to be my warmup.

    When the project first comes out I look at it and determine how long it will take me. Then that night i drink precisly 2 Old English 40's (no more, no less) and determine how long it will take to do while drunk. Then i turn on some Techno and attempt to start coding. Once i forget the name of the file i close it and go play q3 or starcraft (starcraft has to be the best drunk game ever). This continues for a few more days while i have all of the files cr
  • Just GET TO WORK! No wonder so many of our jobs get outsourced over seas.
  • I always check Megatokyo, Penny Arcade, Userfriendly, Get Fuzzy, Dilbert, and NonSequiteur. After that, I'm ready for lunch! -PS

"Ninety percent of baseball is half mental." -- Yogi Berra

Working...