The Profound Programmer

Tags: ,

25 Responses:

  1. NotTheBuddha says:

    Why are tab indents bad?

    • jwz says:

      Oh my god, we are not doing this again.

      Because fuck you that's why.

      Let's just leave it at that.

      • Kevin says:

        B-b-b-but Makefiles! hehe

        • * shakes fist angrily *
          I hate whoever decided that Makefile and syslog.conf should require tabs.

          "Hey! I know! Let's make an invisible whitespace difference be syntactically important! It's clever or some stupid-ass thing..." * cockpunch *

          • David says:

            I once worked where some geniuses wrote a distributed build/test system and mimicked Makefile syntax, complete with the magic tabs. And were proud of that, because hey! You already know how to write Makefiles!

            Mind you, they didn't implement deep dependencies, so if A depended on B and B depended on C, you needed to explicitly say that A depended on C. But tabs! You're familiar with it! It's great!

          • JT says:


      • gryazi says:

        I just had the strangest dream.

    • Robert Ames says:

      It took me a while to "see the light" but I have to agree with jwz. The best argument I heard was: "You never put a ^G (bell) character in a file on disk, why do you think it's OK to put ^I (tab) characters in a file on a disk".

      From JWZ's treatise:

      """My opinion is that the best way to solve the technical issues is to mandate that the ASCII #9 TAB character never appear in disk files: program your editor to expand TABs to an appropriate number of spaces before writing the lines to disk. That simplifies matters greatly, by separating the technical issues of #2 and #3 from the religious issue of #1."""

      The converse towards people who enjoy using tabs while editing ... that is perfectly fine, acceptable, wonderful, etc. just never write them to disk. Most editors have a way to convert tabs to spaces (or vice-versa) automatically. If your editor can't then you need to find a better editor. And besides most mouth-breathers who don't understand how tabs v. spaces work tend to gravitate towards using spaces so it all works out in the end.


  2. latemodel says:

    Hey, now. Besides loop counters, single-letter variables are acceptable when they represent variables in a math equation, and where deviating from the single letter used in the equation would be more confusing. This is only really acceptable when the equation is included, either by reference or in its entirety, in the comments.

    And no, TeX is not acceptable for inline comments.

    • bud says:

      The necessity of the caution highlights this as the exception that proves the rule.

  3. bud says:

    The sentiment expressed in the fourth frame is my usual response upon seeing code which I wrote late in the previous evening.

  4. I don't even use single character variables in bash scripts, and I'm a sysadmin. How bad a programmer must a person be to do that...

  5. jt says:

    Abbreviated variable names are fine as long a you can see the entire scope of their use in one screen. Single letter ONLY for loop vars.

    • Chas. Owens says:

      What about lambda arguments? Especially ones to mapping and sorting functions? Or exception objects in a catch? The are a ton of places where you have a small block of code where single letter variables are nice. And then there are the cases where the proper name for a variable is a single character: a and b when sorting or reducing; i, j, and k as indices; x, y and z when talking about coordinates; and mathematical constants or variables (e.g. n and k in binomial coefficients).

  6. John Fiala says:

    I'm really fond of that last one.

    • James says:

      The best thing about assembler is that there was a comment on almost every line.

      • bud says:

        Except when there wasn't.

      • Tom Lord says:

        ;; load the accumulator with 4
        ;; compare to zero
        ;; done? go refresh then
        ;; decrement x
        ;; this is the really hairy bit!
        ;; total magic, thanks to tony!
        ;; go back to the top of the loop
        ;; magic numbers
        ;; oops... bug here. FIX