Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Programming Education Software Technology

Ask Slashdot: How Do You Read Code? 337

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?
This discussion has been archived. No new comments can be posted.

Ask Slashdot: How Do You Read Code?

Comments Filter:
  • FFS (Score:5, Insightful)

    by nuckfuts ( 690967 ) on Wednesday July 12, 2017 @06:55PM (#54796925)
    Could you be any more self-absorbed?
    • Re: (Score:3, Funny)

      by Anonymous Coward

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

    • My response was going to be "I just play with myself in the corner for an hour, then announce that the code needs rearchitecting." So yeah, it's possible I guess.

    • Could you be any more self-absorbed?

      ha! found the non-coder!

    • by tomxor ( 2379126 )
      Introspection doesn't mean self absorbed, although reading code in this way is weighted towards the novice; the process of questioning your internal processes is what leads to experts.
  • Easy (Score:5, Funny)

    by alvinrod ( 889928 ) on Wednesday July 12, 2017 @06:55PM (#54796927)
    I just program in write only languages like Perl so I never have to worry about this problem.
  • by CrashNBrn ( 1143981 ) on Wednesday July 12, 2017 @06:59PM (#54796959)

    What competent programmer converts the abstraction of code to ENGLISH to grok it?

    generally translates to "for size T i equals zero, i less than item list dot size, plus-plus i.

    No it doesn't. It translates to, "Iterate 'itemlist'" , You're Welcome.

    • What competent programmer converts the abstraction of code to ENGLISH to grok it?

      None so far.

      No it doesn't. It translates to, "Iterate 'itemlist'" , You're Welcome.

      "loop"

      • What competent programmer converts the abstraction of code to ENGLISH to grok it?

        None so far.

        No it doesn't. It translates to, "Iterate 'itemlist'" , You're Welcome.

        "loop"

        It's a little more than just "loop"; closer to "iterate itemlist" (assuming it's translated into words at all). It's important to note what is being looped over. In addition, when I read a for statement, I not only note what's being looped over but examine the pieces of the construct to see if anything unusual is being done. In the example above, a quick scan would confirm that it's a bog-standard iteration over the entire collection... unless there's a break or early return, so my eyes would next flick dow

        • It's a little more than just "loop"

          Maybe in the head of someone not quite as talented.

          What is being looped over is not defined by that for statement. Only the limit of the loop is defined by that for statement. What is being looped over is defined by the block of code after the for specifically by how the loop index is used.

          YOU are welcome.

    • by alvinrod ( 889928 ) on Wednesday July 12, 2017 @08:23PM (#54797413)
      I recall reading a paper once that mapped how novice programmers read and understand code onto a mapping to express their level of development as programmers. The most basic level was a verbose restatement of the code in English, without grasping what the code did as a whole, whereas the highest level was a high-level description of what it accomplished, typically in as few words as possible.

      Also, "plus-plus variable" seems like a bad way to word it internally even if you're breaking it down to the most basic level. "Pre-increment variable" seems like a much better way to think about it, especially if it's being used as an index into an array or anywhere outside of a standalone statement .
    • Indeed. If I'm looking at an unfamiliar coding style, I might lapse into moving my mouth when I read it, but if it's written comprehensibly, I start thinking in terms of states and contents of memory locations. It's usually supposed to go the other way, I might add: to make a colleague (or myself at a later time) understand something in a compact way, I'd express it in pseudocode in an email or on a whiteboard rather than in English prose or even mathematical notion (sometimes, that's a rabbit hole too deep
    • by bidule ( 173941 )

      Yep. If you sub-vocalize code, you're doing it wrong.

    • What competent programmer converts the abstraction of code to ENGLISH

      Better to convert it to Hungarian [wikipedia.org]

    • by jeremyp ( 130771 )

      No it doesn't. The iterator (i) doesn't iterate the list, it iterates a set of numbers that hopefully correspond to the indexes of the list.

  • by __aaclcg7560 ( 824291 ) on Wednesday July 12, 2017 @07:02PM (#54796973)
    My initial response is, "who wrote this shit?!" And then I recognize it as my own code.
    • by networkBoy ( 774728 ) on Wednesday July 12, 2017 @07:50PM (#54797241) Journal

      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".

      • by swillden ( 191260 ) <shawn-ds@willden.org> on Wednesday July 12, 2017 @10:31PM (#54798051) Journal

        BTDT, more times than I could possibly remember.

        OTOH, I'm proud to say that there have been a number of times in the last few years (of a 30 year career) that I've looked at something and thought "Damn, this is really clean and elegant, and that bit is incredibly clever in its simplicity"... and then realized that was my code. And I've had co-workers compliment me on the simplicity and clarity of my code. That is an awesome feeling.

        On the gripping hand, I would *not* say that of the project [googlesource.com] I've been working on for the last three years. It started out fairly decent (not great, but good, IMO), but has gotten very crufty and at this point is pretty hard to follow. It really needs a major refactor. If I only had a quarter to spend on cleanup... but new requirements come in too fast.

        Writing working code is easy. Writing readable code is much, much harder. Worth the effort, though.

        Here's a tip: Once you have developed enough as a programmer to have a good sense of what's clear enough to be readable to another programmer (i.e. yourself in three months) and what isn't, enough that you know when you need to add explanatory comments to clarify how bits of the code do their job, then you should start treating inline comments as a code smell. If the code can't stand on its own, refactor until it can. Often this is as simple as picking some better variable or function names, or pulling apart a calculation so you can assign parts of it to well-named variables, or factoring a block of code out into a separate method so you can give it a descriptive name. Other times, after doing all of that it's still not good and you need to do a deeper refactor. But don't be satisfied until the code can stand alone, comment-free, and still be clear, concise and straightforward. There are some cases in which this is impossible, but I think they are rare.

    • I don't think I've ever not recognised my own code.

      But occasionally I wonder what the hell I was smoking and if I have any left.

    • I hope you are kidding. If I look at code I wrote even a decade ago, and I have code in my product that is older than that so I do it all the time, I find it very readable. If you can't read your own code, I pity anyone else who has to work on it.

  • by david.emery ( 127135 ) on Wednesday July 12, 2017 @07:08PM (#54796995)

    Even when the identifiers were in a foreign language... I worked for Siemens US research lab back in the '80s, and saw a fair amount of code that looked like

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

    (mostly made up German-sounding words there... I knew a bit of German, but the words you learn in high school German rarely made it into computer code.)

    • Re: (Score:2, Funny)

      by Anonymous Coward

      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;

  • by Dutch Gun ( 899105 ) on Wednesday July 12, 2017 @07:08PM (#54796997)

    It's sometimes odd to hear others pronounce code, because it may not align with your own mental map of how things should be pronounced. I remember getting mildly distracted when watching one of Stephen Lavavej's videos because he would call shared_ptr "shared putter" (with the u pronounced similar to 'put'). Why would you abbreviate the sound when it's not any shorter than "pointer"?

    When reading code by myself, though, I think the translation to a phonetic translation happens quite subconsciously, because I'm typically not aware of it at all. It obviously happens to some extent, or I wouldn't have been bothered by STL's reading. So, trying to think it through (which I haven't done before, really), I can assure you that == would never be "equal equal". It would be "is equal to". "cout" is not "kowt", but "see-out". And I use > so infrequently, I think I don't even bother with a mental pronunciation.

    • char Vs. car
      *twitch*

      • Right now, I actually can't figure out which of the 3 I use. It's sort of like when you become conscious of your breathing and it's difficult to get your subconscious to take the wheel again...

        And now that I've typed it, that's exactly what's happening now.

    • Var Char sounds like you're an idiot, or academic, or both.

      Var Kar sounds like you know a bit about programming.

      Var Care sounds like you're too pedantic to know how language evolves.

      So I judge everyone against an internal and constantly evolving standard where everyone else is wrong. Especially when varchar(max) supplants everything and we just sat string or text.

      • by dwye ( 1127395 )

        What about when you pronounce "char" with an aspirated "ch" like in Scottish "loch"?

        But don't take me as gospel; I sometimes put in the initial "h" in Roger - too much reading pseudo-Old English/Old Norse, I expect.

        Still, one has to distinguish between the C char and the LISP car function, doesn't one?

  • by NEDHead ( 1651195 ) on Wednesday July 12, 2017 @07:09PM (#54797001)

    I execute it in a mental virtual machine.

    • by corychristison ( 951993 ) on Wednesday July 12, 2017 @10:03PM (#54797913)

      Not sure how serious you are about this.

      I don't "read" code. I parse it with my eyes, and visualize in my mind what it does and how it will execute. As I look through each code file and put the pieces together I can see the bigger picture and how all of the code interacts.

      When I'm building an application, I do the reverse. I "see" what I want the outcome to be, and build the code to make it happen. Sometimes mulling the structure for days, weeks, months before actually writing any code.

      I'm being quite serious about this... is there a term for this? It's quite difficult to explain to people who don't understand what I mean, and so far the majority of people I've spoken to about it look at me like I'm a nutcase.

      • It is a technique developed in the sixties in California by Werner Erhard generally described as gestalt programming.

        Seriously, est true, I swear it! I can see the whole universe!

        And I feel much better now (here is my check).

      • by dwye ( 1127395 )

        Sounds like what Nikola Tesla supposedly did - building the first AC motors, running them for a year, then breaking them apart and examining them for wear, all in his head, before putting more than a vague sketch on paper. If you can pull it off for more than a few lines, more power to you.

    • > I execute it in a mental virtual machine.
      how do you handle the halting problem?

  • by Anonymous Coward
    Anyone that needs such literal English translations for simply programming structures is either a beginner programmer or really struggles as a programmer. secondly what the hell is this garbage doing being posted here?
    • by Anonymous Coward

      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

      • 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

        Really? I make sure they know which one is the shit tube before they start work. Its not good when they don't.

        • by dgatwood ( 11270 )

          If your plumber is doing that in your kitchen sink, you have much bigger problems than what the plumber calls the pipe.

  • by Anonymous Coward on Wednesday July 12, 2017 @07:12PM (#54797015)

    When I read, I perceive concepts. Only when I can't grasp something right away do I go back and read words "aloud in my mind". That's part of why I hate videos that don't make use of the advantages of the medium. If you just want to explain and not show, let me read it. It's faster.

  • Wrong! (Score:5, Insightful)

    by Chris Mattern ( 191822 ) on Wednesday July 12, 2017 @07:12PM (#54797017)

    "The majority of humans read silently by rendering a simulation of the printed words as if they were being spoken".

    Actually, only people who read poorly do that. People who read well decode printed words directly into mental concepts, rather than sounding them all out, only sounding out a word when it is unfamiliar in print. (see jokes about people whose lips move when they read)

    • Re:Wrong! (Score:4, Informative)

      by Anonymous Coward on Wednesday July 12, 2017 @07:24PM (#54797099)

      Actually, only people who read poorly do that. People who read well decode printed words directly into mental concepts, rather than sounding them all out, only sounding out a word when it is unfamiliar in print. (see jokes about people whose lips move when they read)

      Exactly. Imagine trying to make sense of a web page by sub-vocalizing the HTML as it is printed out.

      • What do you mean by "imagine", you insensitive clod!

      • by Ungrounded Lightning ( 62228 ) on Wednesday July 12, 2017 @09:51PM (#54797851) Journal

        Actually, only people who read poorly do that. People who read well decode printed words directly into mental concepts, rather than sounding them all out, only sounding out a word when it is unfamiliar in print.

        That (essentially correct) observation led to the creation of the "Look-Say" method of teaching English and its replacement of "Phonics" in the public schools.

        Look-Say attempted to skip the "learn new words by sounding them out" step and teach students immediately to use the faster words-as-a-chunk technique of good readers.

        But that ended up crippling them, because it left them with no way to acquire new words. They knew the handfull they'd encountered in class as a set of pictograms but didn't have the "secret code" to parse somethig they hadn't seen before. Result: Mostly illiterate graduates whose reading was so painful to them that they did little, getting farther and farther behind.

        Turns out that good readers of substantially phonetic languages start with sounding-out (Phonics-style). Then as they gain skill and experience they start recognizing progressively more words at-a-glance, falling back to sounding-out when they hit words for which they hadn't yet built a neural-net recognizer. Eventually the "speed-bump" words become so rare that they blaze along familiar vocabulary without appearing to sound-out at all. But new or rare words bring out the old toolset, rather than bringing them to a full stop.

        There are a corresponding pair of methods for learning a "second (i.e. additional) language: The "Grammatical Method" (learn and practice the lnguage rules) and the "Audiolingual Method" (repeat the samples). The latter came from an attempt to emulate the rapid language acquisition of children by modeling their environent

        Tested right after a series of courses, college students taught by either method score about the same. Tested a year or so later (if they haven't been re-exposed to the second language meanwhile) those taught by the Grammatical Method had a significant skill loss, while those taught by the Audiolingual Method were unable to emit any sentence they hadn't encountered in class. Oops!

        Turns out that (unless you learn two or more languages as a child) the neural structures that make kids little language acquisition machines literally die off, in several stages (at the ends of age ranges called "critical periods") as the neurons that weren't used by the language learned are "pruned". Once this has happened, learning a new language isn't impossible. But it's more like recovering from a stroke.

        • by linuxrocks123 ( 905424 ) on Wednesday July 12, 2017 @11:11PM (#54798201) Homepage Journal

          Turns out that (unless you learn two or more languages as a child) the neural structures that make kids little language acquisition machines literally die off, in several stages (at the ends of age ranges called "critical periods") as the neurons that weren't used by the language learned are "pruned". Once this has happened, learning a new language isn't impossible. But it's more like recovering from a stroke.

          This is total bullshit.

          http://citeseerx.ist.psu.edu/v... [psu.edu]

        • The main advantage of the audiolingual method is not actually whether you learn more material in class or retain more material when tested after ignoring the subject for a year. The real advantage is you have practice with useful coherent sentences and can sub out words to easily create new sentences that you are capable of saying out loud to another human being. Yes, the grammar is sometimes crap, but the meaning is sufficiently clear that the locals in that foreign country you are visiting understand.

    • Unless it's a god damned Morgan Freeman meme.... I *always* hear those in his voice.

    • I do not vocalize anything when reading.

      One of the key things about learning 20 WPM Morse Code was that you could no longer think of it as dots and dashes because that would slow you down. You had to recognize the entire sound of the letter as just a sound. Similarly, good readers read entire words at once, not the letters, and they don't sound anything out. Those things slow you down.

      • you may not sound them out, and you may not feel your tongue move, but under a functional MRI the areas of your brain responsible for moving your tongue _will_ light up when you're reading. it doesn't matter how afst you can read.

    • by dwye ( 1127395 )

      It might be nice to remember that this was the only way that people read, for a long time. In Medieval History, I read about early University scholars coming from all over Western Europe to see someone in Italy who read silently, without sub-vocalizing like everyone else did at the time.

  • by dcollins ( 135727 ) on Wednesday July 12, 2017 @07:12PM (#54797021) Homepage

    I teach introductory C++ programming courses at a large, urban community college. Getting students to be able to read and write the syntax reliably is itself a major challenge (e.g., poor initial reading/writing skills, never encountered programming before, about half not native English readers, etc.). So at numerous points during the course I ask for the class as a whole to direct my coding at the lectern for some simple problem. "What should I type here?" And of course, we need some recognized way to verbalize that.

    The OP touches on the toughest nut I've found in that regard -- that there's no agreed-upon way to pronounce the symbols for C++ stream insertion/extraction operators (e.g., the OP mentions that he just leaves those uniquely silent). Notice that I'm talking about the typographical symbols here, not the name of the C++ operator. E.g.: For the C++ "and" operator, you type the symbol "double-ampersand". But if a student were to say, "insertion operator", and I said, "and how do we type that on the keyboard?", there is surprisingly no agreement in what that symbol is.

    Asked this on Stack Overflow a few months ago, to no good resolution: How do you read the... and... symbols out loud? [stackoverflow.com]

    • by KerPow ( 667116 )

      I am a little surprised that most in the linked Stack Overflow comments seem to be losing their collective minds over a trivial naming problem. Unicode gives the names 'less than sign', 'single left-pointing angle quotation mark', 'left-pointing angle bracket', 'mathematical left angle bracket', and 'left angle bracket'. Take your pick and add the word 'double' to the front. I would shorten to 'double left bracket' if context clues make the outcome obvious. The same applies to the right-hand version of the

      • by Malenx ( 1453851 )

        I wouldn't even bother with double left bracket, just double bracket. The opening and closing become second nature very quickly.

        Also, I don't think I've ever even needed to type the word "and" while writing code, so saying "double and" or "and and" can easily convey &&.

        I agree with you, simplifying unicode names is a great start for the classroom.

      • by smelch ( 1988698 )
        I always go with "less-than less-than" in the same way I say "equals equals" for "==" if I am telling somebody what to type. If I am not telling them what to type exactly (like somebody more experienced) I would use language like "bit shift to the left 2" or "write out str" leaving the stream I am referring to implied, or in the case of HTML where I wanted an element with attributes "open a div [pause until they've written div] class equals my class".
      • by jeremyp ( 130771 )

        I read << as "shift left" and if I was dictating to somebody else who could also code I would probably say "a left shifted b"

    • Perhaps you should consider looking to Victor Borge [youtube.com] for advice...

    • ... there's no agreed-upon way to pronounce the symbols for C++ stream insertion/extraction operators (e.g., the OP mentions that he just leaves those uniquely silent)

      Most of those symbols had "hacker slang" pronounciations, back when C++ was new. They weren't universal, of course. (Different clutches of hackers would sometimes have variant vocabulary.)

      Most of the symbols inherited pronounciations from C, of course. But insertion/extraction (in the clutch of hackers I hung with) inherited from the analo

    • To assist reading, I would prefer using keywords [cppreference.com]. For example, 'not A and B' rather than '!A && B'. It seems to improve readability, less error prone (no accidental 'A & B', which is 'A bitand B' with keywords).

      I don't know your teaching methodologies, but please watch the Stop Teaching C [youtube.com] presentation by Kate Gregory, where she shares her experience on teaching C++ and how to make it less confusing for novices.

  • WHEN YOU READ THIS THE LITTLE VOICE IN YOUR HEAD SCREAMS

    however, the lameness filter complains, so this useless text has been added
    */

  • Sorry, I can't. My code is in Perl.
  • when I am reading javascript in code review I always say "Threequals" for the === operator. It hasn't caught on... People in code review still groan when I do it.
  • most can't read (Score:5, Interesting)

    by fermion ( 181285 ) on Wednesday July 12, 2017 @07:22PM (#54797089) Homepage Journal
    Most people read barely above a elementary school level. The average newspaper is barely written at a high school level. Reading is a recent technological development, and only a fraction of the population is truly proficient. For example, one innovation we need to make if we want people to be education beyond high school, which given the skills we need in the wordplace is a given, is to be less dependent on reading as the primary teaching method. It is efficient, but most people are not proficient.

    That said code should be written in small snippets and as much as possible idiomatically. One recent troubling innovation I have seen are developers trying to do several things in one line of code, like they are trying to win the c obfuscation contest. It makes little sense as we are not using teletypes, and the compiler will optimize code as needed. What we know is that gates and memory is much cheaper than people, and we only need to optimize the code that is run often and is in fact slow.

    So, to answer the question, how we read code depends on how code it written, just like we read anything. For the most part code should be written as easily accessible poetry, not literature, not a physics textbook. The skill in reading code, again just like any reading, is not the decoding or sounding out of the text, but the comprehension of the meaning.

    • by mark-t ( 151149 )

      The average newspaper is barely written at a high school level.

      Specifically, the average newspaper is written at a grade 7 reading level.

      Reading is a recent technological development

      Perhaps... but only in about the same sense that you would say that human beings are a recent development as well. Reading is well over 5000 years old, and has origins in numeracy which itself is over 10000 years old.

    • less dependent on reading as the primary teaching method.

      No. The written word is explicit. Spoken words are subject to being misunderstood as other words. Instructional videos are fine, but not always applicable. Sometimes videos are easier to make than written descriptions, sometimes much more difficult. What other methods are there - pictograms?

      Most high level learning must be done primarily with words, including symbols and numbers.

  • I only write it. Reading code is for the little people.

  • OK, I tried
    (first '(A B C))
    and it came out:
    "Car Quote A B C Damn kids get off of my lawn."
    I hate getting old.

  • I do not read (Score:5, Interesting)

    by manu0601 ( 2221348 ) on Wednesday July 12, 2017 @07:45PM (#54797201)
    Your post made me realize I do not read the source, I look at them it like I would do with a map or a geometric shape. And when someone reads me code, I have to do the mental work of representing it differently as when spoken.
    • Re: (Score:2, Insightful)

      by Anonymous Coward

      This is why I have difficulty reading oddly formatted code. The shapes don't match up. All the correct characters are still there, but they're damn near illegible until I really slow down and read like a kindergartner.

      I've been programming long enough that I can recognize most of the usual formatting styles without too much trouble. But when people use something really off the wall, or when (I hate these people!) different developers insist on each using their own style back-to-back in the same chunk of

  • by ZackSchil ( 560462 ) on Wednesday July 12, 2017 @07:51PM (#54797249)

    I typically only read code aloud in two cases. The first is is there's a really stubborn logical bug and it's just not popping out at me. The translation into english often helps point out where I've gone wrong. The second is when coding with someone, it's nice to say code aloud just for communication.

    I tend to read code in a way that sticks to the ordering of the code, but makes its meaning more clear with the insertion and substitution of words.

    "char* example;" becomes "define a character array called example"

    "for (size_t i = 0; i itemList.size(); ++i)" becomes: for i equals zero, while i is less than the size of item list, pre-increment i.

    && is just 'and', || is just 'or'. & and | are "bitwise ___".

    "cout str endl" becomes "send to see out, 'str', followed by an endline.

    I try to keep the order of the code mostly in tact, and keep the keywords without changing them, but I like to make sure everything turns into an english sentence that kinda makes sense even if you're not super familiar with the language. Obviously, if I have to get into gritty syntax, I'll character by character recite, using words when possible, but that's rarely necessary.

    Saying stuff like "char star example semicolon" is just kinda incompatible with the way my brain works. It would like if you had spoken to me by spelling out each word in the sentence you wanted to say. I'll get it but it'll take me a second.

  • The loop for(size_t i = 0; i

    That's just "while i is less than size" as I read it. C style for loops are just while's bookended with the counter. I seriously can't read all the punctuation like he does. Feels way too pedantic.

  • I don't make any mental "sounds" when I read code because I parse through it way too fast but when I'm writing it I do, translating it into something for my brain to type out. I make a lot of beeps and grunts in my head because of that. Parens are a "hernk" noise which get louder the deeper they're nested and semi-colons and periods generally become a 'boop' or "donk." Curly braces are we weird "hurrah"-ish sound on opening and on closing a sad-ish "hurrah."

    Despite doing this stuff for the last 25 years I

  • Or just self righteous and pretentious snobs who think they are superior because how dare you think they read like the masses.

  • I'm not sure how it happened, but I found that during the course of my career as a coder, I also became a speed reader. Like, I'm an absurdly fast speed reader now, and it's fucking odd. I don't really have a voice in my head when I read anymore, unless I'm doing it intentionally. Slows things down, and it's unnecessary. Pretty sure the two are related, but I couldn't tell you when it happened. If I had to guess, I would say it probably has something to do with spot reading thousands of manuals over a 20 ye

  • for(size_t i = 0; i

    Wtf? Of course you mean

    for(auto const & i : itemList )

    • itemList.forEach( o -> {...});

      for (final Item item : itemList) { ....
      }

      Iterator itr = itemList.iterator();
      while (itr.hasNext()) {
              final Item item = itr.next();
      }

  • by mark-t ( 151149 ) <markt.nerdflat@com> on Wednesday July 12, 2017 @09:06PM (#54797649) Journal

    If I am reading code out loud, I read == as "double equals", -> from C as "arrow", ++ and -- as plusplus and minusminus, respectively, and when reading javascript, === as "triple equals". I read the period when used as a separator from an object and its members as "dot", but when it is in a decimal number, I read it as "point". I read "&&" and "||" as "logical and" and "logical or", respectively, the boolean "&" and "|" as simply "and" and "or", and the & operator for taking the address of a variable as "ampersand".

    When reading code silently, I don't think I associate real words to anything I am reading.. The smallest unit that I generally internally think of in code is a whole line at once, and often I think in terms of entire functions, as long they are small enough to fit on single screen without scrolling (a practice I try to adhere to, personally... as I find it results in more readable and comprehensible code).

  • by OrangeTide ( 124937 ) on Wednesday July 12, 2017 @10:14PM (#54797977) Homepage Journal

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

  • I like attributes and logic (expressions) in a tubular form to both more easily identify visual patterns, and to re-project (query) the tables to emphasize different things for different needs: one is not stuck with the original coder's layout and positioning. Early on even with textual code I'd line up similar function calls so that parameters lined up into columns.

    When I tried to promote the idea of "Table Oriented Programming"*, debates ensued about grokking, and I eventually realized how differently peo

  • Yawn, When I am reading lines and lines of code it sure is not aloud ;) Just saying.
  • "As a programmer (and a reader of fanfiction), plenty of things I read are not valid English syntax."

    As a long-time Slashdotter, plenty of things I read here are not valid English syntax.

  • ...preverbalizing identifiers can aid in recall, though if they are not poorly named sometimes can be skipped. I don't preverbalize the following but this is what I think when I read your examples:

    int i = 0; --> "there is a machine size int named i for a while, probably used as an LCV or index"

    if(i == 0) --> "enter this area of code when i is 0"

    for(size_t i = 0; i "start at 0 and go as many times as there are items in itemList...unless something messes with i in the loop. Also, how sure are you

  • by jimtheowl ( 4200185 ) on Wednesday July 12, 2017 @11:38PM (#54798291)
    For example, take the following MIPS Assembly:

    andi $a3, $t1, 41399

    Which translates to: 001100 010010 011110 100001 101101 110011

    Can easily be read as zero zero one one zero zero ...

    and as a result will initiates a paradox-correcting timesphere.
  • ... the program. You get used to it, though. Your brian does the translating. I don't even read the code. All I see is blonde, brunette, probable deadlock. Hey, I think I need a drink.

  • if myself not in current_posters and free_time > 20:
    1. post_comment(comment_text)
  • You need to understand it, if you can.

  • i usually read it out directly in compiled MMIXAL.

One man's constant is another man's variable. -- A.J. Perlis

Working...