Slashdot Mirror


Ask Slashdot: How Do You Read Code?

New submitter Gornkleschnitzer writes: The majority of humans read silently by rendering a simulation of the printed words as if they were being spoken. By reading that sentence, chances are you're now stuck being conscious of this, too. You're welcome.

As a programmer (and a reader of fanfiction), plenty of things I read are not valid English syntax. When I find myself reviewing class definitions, for loops, and #define macros, I rely on some interesting if inconsistent mental pronunciation rules. For instance, int i = 0; comes out as "int i equals zero," but if(i == 0) sometimes comes out as either "if i is zero" or "if i equals equals zero." The loop for(size_t i = 0; i < itemList.size(); ++i) generally translates to "for size T i equals zero, i less than item list dot size, plus-plus i." I seem to drop C++ insertion/extraction operators entirely in favor of a brief comma-like pause, with cout << str << endl; sounding like "kowt, stur, endel."

What are your code-reading quirks?

7 of 337 comments (clear)

  1. Easy by alvinrod · · Score: 5, Funny

    I just program in write only languages like Perl so I never have to worry about this problem.

  2. I don't read the code by NEDHead · · Score: 4, Funny

    I execute it in a mental virtual machine.

  3. Re:Ada was always pretty easy to read by Anonymous Coward · · Score: 2, Funny

    A literal 1 in Ada code? That can't be right. I think you mean:

          for Untzelgerflekenzet in Positive'First .. Ausplotzenfargang loop
                      Geinengemacht (Zealer => Untzelgerflekenzet, Zugemacht => Sptizelgang);
          end loop;

  4. Re: don't we have editors to block this garbage? by Anonymous Coward · · Score: 2, Funny

    Before I hire a plumber, I ask him how he pronounces all the pipes he will be working on. If he says "shit tube" for the kitchen sink supply I do not hire him

  5. Re:FFS by Anonymous Coward · · Score: 3, Funny

    Do the submitter's lips move when he reads code?

  6. Re:One line st a time... by networkBoy · · Score: 3, Funny

    I actually said "What the fuck were they thinking? This is the most obtuse shit I've seen in a long time, it's almost what I'd do if I hated the maintenance coder."

    Co-worker over the cube wall asks what module, I respond.
    Co-worker over the cube wall snickers and says "blame".

    me-does blame
    "Oh fuck I hate myself, and apparently I knew that 6 months ago".

    --
    whois gawk date unzip strip find touch finger mount join nice man top fsck grep eject more yes exit umount sleep dump
  7. How Do You Read Code? by OrangeTide · · Score: 4, Funny

    I try to give each function a different characteristic voice. I use a high pitched voice for smaller functions.

    --
    “Common sense is not so common.” — Voltaire