Slashdot Mirror


Programming Warm Ups?

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?"

24 of 84 comments (clear)

  1. coffee by Hubert_Shrump · · Score: 4, Informative

    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.

    --
    Keep your packets off my GNU/Girlfriend!
    1. Re:coffee by compwizrd · · Score: 4, Funny

      and by that time, it's time to go home!

    2. Re:coffee by jon787 · · Score: 2, Funny

      sssshhhhh

      I'd say in a given week I probably only do about fifteen minutes of real, actual, work.

      --
      X(7): A program for managing terminal windows. See also screen(1).
  2. Check some web sites by SoCalChris · · Score: 2, Interesting

    I always scan through the new articles here on /. and Fark.com before starting the day. It sort of gets me thinking a little, and starts the day off interesting.

  3. The usual by adamy · · Score: 4, Insightful

    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.

    --
    Open Source Identity Management: FreeIPA.org
    1. Re:The usual by Master+Rux · · Score: 3, Funny

      1. Drink Coffee
      2. Read Email
      3. Read Slashdot
      4. ...
      5. Profit!

      --
      IMO the best browser game ever http://wittyrpg.com
  4. Warm-Ups? by chemstar · · Score: 5, Funny



    I don't know, five years at a University?

    1. Re:Warm-Ups? by Master+Rux · · Score: 3, Funny

      Yeah, but I don't think I'd want to do that every morning.

      --
      IMO the best browser game ever http://wittyrpg.com
  5. My routine by OiBoy · · Score: 3, Funny

    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

    --
    `fortune -o`
  6. Gradual warm ups by GuyMannDude · · Score: 5, Funny

    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

  7. Space out by fredrikj · · Score: 5, Funny

    Obligatory Office Space quote:

    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.

  8. Warm ups for the entire body by GuyMannDude · · Score: 4, Funny

    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

  9. Python by Apreche · · Score: 4, Interesting

    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.

    --
    The GeekNights podcast is going strong. Listen!
  10. Advice for writers by DrCode · · Score: 4, Informative

    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.

    1. Re:Advice for writers by mr3038 · · Score: 2, Interesting
      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 something wrong with the code. If it looks good, then by the time you get to the end of the diff your thoughts should be on the right track again. Of course, the project quality as a whole might benefit more if you reviewed code written by somebody else, but that somebody else probably has pretty different way to think about the problems to solve so it probably wouldn't help your thinking. If that somebody else is much better coder than you're, then by all means, read his code instead of yours - perhaps you learn something new during the process.

      On the other hand, when my thoughts are lost, I usually read email, check /. and end up spending half a day looking through all linked the stuff from the discussions, so take my advice with a grain of salt.

      --
      _________________________
      Spelling and grammar mistakes left as an exercise for the reader.
  11. funny? by Hubert_Shrump · · Score: 2, 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!!

    --
    Keep your packets off my GNU/Girlfriend!
  12. From the Good Dr.... by mbstone · · Score: 2, Funny

    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."

  13. Start away from computer by rjethmal · · Score: 2, Interesting

    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 because it allows one to see some progress, which is always a good motivator!

    --
    Push the envelope. Watch it bend. -Tool
  14. Exercise by LadyLucky · · Score: 4, Insightful
    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.

    --
    dominionrd.blogspot.com - Restaurants on
  15. Kata by darkpurpleblob · · Score: 2, Informative

    Have a look at CodeKata, coding practice sessions. Doing one of these occasionally (start of each week?) may help you get into the right frame of mind/attitude.

  16. little annoyances first by pz · · Score: 4, Informative

    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.

    --

    Put my fist through my alarm clock with its ding-dong death inside my ear. - The Blackjacks.
  17. Logic game by Lord+Grey · · Score: 3, Interesting
    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.

    --
    // Beyond Here Lie Dragons
  18. Re:The Obvious by Glonoinha · · Score: 3, Insightful

    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.

    --
    Glonoinha the MebiByte Slayer
  19. Think. Read. Eat. by zedeler · · Score: 3, Interesting

    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.

    Next, read books and standards . 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.