1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

How to deal with coding dillemnas

Discussion in 'Programming & Webmastering' started by Kreij, Oct 14, 2009.

  1. Kreij

    Kreij Senior Monkey Moderator Staff Member

    Joined:
    Feb 6, 2007
    Messages:
    13,881 (5.08/day)
    Thanks Received:
    5,615
    Location:
    Cheeseland (Wisconsin, USA)
    The P&W forums have been a tad serious lately.
    This is normal as when people are coding something they tend to focus only on the task at hand and have difficulty separating themselves from their given/chosen quest.

    So, I figured I would write a little essay that will both inform people and with a bit of added humor, set them back on the right mindset for coding and also clue them in as to what they can expect from people here on TPU.

    We can categorize coding problems in a few ways. Let's look at them;

    Issue : I have no !@#$ idea what I am doing
    This is the curse that plagues all new coders. They are trying to write a program for a class at school or got tossed into a work project that is somewhat beyond their current expertise.
    Answer : Relax
    If you are a student simply follow these guidelines.
    1)Start your project as soon as you get the assignment, do not wait until the night before it is due or we won't be able to help you. We will not do your homework for you. We will be happy to explain anything you are not clear on. We will not charge you. We are better than the assistants at your university. But hey, it's your call.
    2)Never assume that your question is too basic or that you are embarrassed to ask a question. Just remember that as Ceasar was dying he said “Et tu, Brutus”? Well, duh. Brutie-tootie was standing there with a knife in his hand, wasn't he? No question is too stupid. No one is born knowing how to program and everyone who has the motivation to learn will have questions. We are here to help.
    If you are in the workforce, follow these simple guidelines.
    1) Read student section #1 above.
    2) Read student section #2 above.

    Issue : It's a lot of typing and I'm not very good at typing.
    Answer : Practice
    You're at a computer. The input device is a keyboard unless you have some kind of speech recognition software. Deal with it … and learn how to spell for God's sake. If you put a comment in your code like …
    Code:
      // we cin jus caluatrate the fomule her.
    
    … you will be the laughing stock of the coding world. Even after you have died. Why leave a legacy for your children where people knock on the door and say, “I knew your dad/mom. Their coding was suxor!.” The people on TPU are usually pretty good about overlooking typing errors, but be reasonable, if you suck, you suck. Take a class before someone goes over the edge due to your crappy writing and takes a hostage.

    Issue : I wrote some code, but now can't figure out what it does
    Answer : Use a consistent coding format
    Name all variables by what they contain, do not use cryptic constants, do not purposely obfuscate your code (unless it is a requirement), and for the love of all, do not use GOTOs if you can avoid it. GOTOs are a leftover from an era when coders had to quick write something to get it working before they were eaten by dinosaurs. Do you honestly believe that a month after you write a line like “var a = b+ c * (b/c)*d” you will remember what it does? Do you know how many coders have died from writing bad code after the poor schmuck who ended up maintaining their code could no longer stand it, hunted them down and capped their sorry butt? A lot. But you never hear it on the news because it is covered up. Kind of like a special forces mission, only different.

    Issue : I can't come up with a good idea for a new program
    Answer : Write Tetris clones until you are so bored that you spleen reaches up and skewers your brain
    This always works.

    Issue : I don't like the code I wrote
    Answer : This is called “Coders' Block”
    It usually manifests itself in a manner which sneaks up on you. One day you are pounding out line after line, and the next you are deleting a months worth of work.
    Coders' tend to be their own worst critics (which is not a bad thing), but when you are trying to optimize a statement like “MyVar = 10”, you know it's time to take a break.
    Turn off the computer (if you are at work, just walk away from it). Go outside and take a deep breath (not recommended in Los Angeles and some parts of Detroit), Come to the realization that you are becoming a coding zombie and it's time to do …. anything different for awhile. My personal preference is to drink a copious amount of beer and ride through all kinds of muddy trails on my ATV. If you live in a urban or suburban environment where you cannot get out into a peaceful setting, I would recommend just stalking your neighbors kids. It's always a barrel of laughs. Guns really help to take your mind off of programming woes too, even if they are pointed at you.

    Issue : This post did not cover my problem
    Answer : While we try to cover everything most of us are not experts in proctology. See your doctor.

    While I obviously could not cover all the issues that coders' face, I hope that this little foray into some of the issues helped you out. If not, who cares, I've got code to write.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page