Coding 101, by John Keklak

October 6, 2006

After my CS411 class this week, I am completely inspired to post what must be made clear as a message to the world courtesy of the teachings of one John Keklak. And that is coding standards. So here we go:

  1. Indentation with discipline. Not only must you indent every time you start a new line, but you want to make sure your code makes the person who reads it feel like they’re being punished by reading the code. After all, we don’t just write code. We go through a process. For example:
  2. int getNumTasks(table){
    int a = numRows(table);
    return a;
    }

    Now this, who can read this? I mean it’s a bunch of gibberish and really, what do I get out of it? But take this example:

    int getNumYOUREANIDIOT(GO TO THE CORNER OF THE ROOM){

    int YOURENOTALLOWEDTOWATCHTVTONIGHT = YOURE PATHETIC!;

    return YOUREGOINGTOBESERVEDTOTHESHARKS;

    }

    Not only is that readable, but it tells you a message. And it disciplines the reader. I can’t tell you how much that makes coding in real projects go much quicker. Pink slips have disappeared thanks to this method. Read the rest of this entry »

Advertisements