Slashdot Mirror


User: richardchaven

richardchaven's activity in the archive.

Stories
0
Comments
7
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 7

  1. Re:Ockham's Razor tells me.... on Why Corporates Hate Perl · · Score: 1

    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

  2. Re:Ockham's Razor tells me.... on Why Corporates Hate Perl · · Score: 1

    I disagree If I have more than one, I use ENGLISH WORDS to describe it: InnerCounter, TotalAmount. As for your "traditional" variable names, they come from a time where source-code length mattered, and from a time where CS was in the math departments because it sort of looked like math. "i" and "j" are easy to confuse in the morass of j += ((i+2)/j), etc. Not only do they look alike, but they have no intrinsic meaning. TotalAmount += (TheseItems[Counter].Price * Quantity) * (1 - ThisDiscountPercent) But have I erred again? Do you dislike parentheses used solely for clarity? Do you feel that "real coders" have memorized the Order of Operator Precedence? Or that everyone should just "read the code" rather than expect clear comments? Do you think that l+=j[i].pr*q*(1-d) is better code? The goal of software is to solve the users' needs, not ours. Bugs happen through misunderstanding, not mis-typing. Things that make code easier to read and understand are aids in a professional's toolkit, hackers' macho be damned.

  3. Re:Ockham's Razor tells me.... on Why Corporates Hate Perl · · Score: 1

    you need to be a mix of Bill Gates and Randal Schwartz to get in ... Oh, I am! Not a full-strength mix, mind you

  4. Re:Ockham's Razor tells me.... on Why Corporates Hate Perl · · Score: 2, Interesting

    my PERL code looks like Pascal: descriptive variable names; breaking evaluations and operations into intermediate steps; king-pinning functions. For example, I name the iterating variables in "for" loops 'counter', not 'i'

    Some Delphi programmers think I'm too descriptive.

  5. Re:Ockham's Razor tells me.... on Why Corporates Hate Perl · · Score: 1

    Agreed. Attitude is everything. I've seen Object Pascal code that was spaghetti crap. My (rare) PERL stuff was completely readable because of comments and function names that actually described what they did. "Real" PERL coders would have laughed... I find that those who were around before objects and learned Structured Programming make better OO coders because we know why objects are good; we appreciate them. We are the antithesis of Ex.P. because we respect the next person to read the code (e.g. ourselves) enough to make it readable.

  6. Re:Oblig. Futurama Ref. on McCain Campaign Uses Spider/Diff Against Obama · · Score: 1

    If it's just a matter of degree, then it's every gored ox for one's own (which is what we have now). Correct me if I am wrong, but is not a base belief of Libertarianism is that people should be allowed to make bad decisions (i.e. the government should not protect people from their own judgment)?

  7. Re:Oblig. Futurama Ref. on McCain Campaign Uses Spider/Diff Against Obama · · Score: 1

    "It's moreso simply a party centered on freedom. Put in enough basic laws to keep society running at a reasonable level (ie, theft, rape, murder are illegal) and besides that have the government butt the hell out of our lives." So you have such respect for the civil justice system that no one can do anything to someone else that a lawsuit isn't the best way to resolve it? Or does everyone have to be a epidemiologist with near-infinite time to do research so they can find out what kind of paint is safe to use? Everyone wants less government, but not when they get e-coli in their meat, salmonella in the vegetables, and lead paint on their toys. Oh, never mind...