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?
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?
Could you be any more self-absorbed?
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.
I got the fuck out of coding and IT, like any bright person would do.
The handwriting is on the wall. Silicon Valley is overrated and overcompensated and it's only a matter of time...
My initial response is, "who wrote this shit?!" And then I recognize it as my own code.
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?
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.
"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)
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 code, I have to switch gears into an entirely different (and much slower) mental model.