Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror

Comment Re:Ockham's Razor tells me.... (Score 1) 963

Golly, I read Knuth, and Kernighan, and McConnell. Perhaps the introduction to Knuth will help you understand the difference between algorithms and implementation. Take a look at Steve Gibon's beautiful assembler code if you want a clear example of low-level code with high readability.

If clear code is "old-fashioned", then get my horse and carriage ready. Ad-hominem aside, yes, you CAN read that COBOL code even if you never used COBOL; is that a bad thing?

Good code is good code: COBOL, C, Algol, Basic, or Ruby.

I think Hungarian notation is worse than using the words "Button", "List", "Array", etc. because it is a shorthand, and we don't need to speak in shorthand. Understanding what the user wants and what our fellows mean and "What in hell were they thinking when they wrote this code?" is enough of a challenge.

You think that

void initcheckers(void) {
    int i,j;
    for (i=0;i7;i++) {
        for (j=0;j7;i++) {
            piece[i][j]='';
            color[i][j]=(i+j)%2;
        }
    }
}

is more readable than

void initializeCheckersBoard(void)
{
    int ColCounter, RowCounter;

    for (RowCounter = 0; RowCounter NUMBER_OF_ROWS; RowCounter++)
    {
        for (ColCounter = 0; ColCounter NUMBER_OF_COLS; ColCounter++)
        {
            SpotPieces[RowCounter][ColCounter] = '';
            SpotColors[RowCounter][ColCounter] = (RowCounter + ColCounter) % 2; // alternate colors
        }
    }
}

You can use the wrong word or poor spacing to make a bad example of any system; the bottom line is not impressed by knocking down straw-men.

BTW: Did you spot the bug I introduced in your version of the function? How easily would a new maintenance coder spot it?

Cheers

Slashdot Top Deals

Regarding astral projection, Woody Allen once wrote, "This is not a bad way to travel, although there is usually a half-hour wait for luggage."

Working...