Asking people what they've read "just for the heck of it" is the wrong question, because code is not linear , so it's extremely ungainly to read without purpose. But as soon as the skilled code reader has a purpose in mind -- a question to answer -- he or she can rapidly find a meaningful narrative. Put into that context, programmers read code constantly, and the more they read the better they get. So I don't like th…
Code is not Literature
61–70 of 88 posts
Re: Code is not Literature
#62If you asked a different question, like "explain how you read code in the course of a typical project or experiment" you will get a ton of examples. They might describe how they look to understand the basic data structures, and then imagine some sample data flowing through the algorithm to understand the purpose, and then examine the details, edge cases, and interactions to see why some non-obvious choices were made. Then they might describe how they use this to find what parts of the code should be generalized, specialized, or extended to fit new functionality.
It might be interesting to incorporate code reading into an interview to see the strategies that people use. It would be quite difficult to make it a fair question, though, because patterns vary widely and it often takes more than an hour or so to adapt.
Re: Code is not Literature
#63It's a cultural, psychological, linguistic mixup more than anything else. People do read code all the time, they just hesitate to respond to a question like "what code have you read recently". It's hard to answer that question in english without implying that you have completely read a program (rare) that was completely written (in other words, "finished", which is even more rare). If you asked a different question,…
Re: Code is not Literature
#64Re: Code is not Literature
#65Earlier quoted context omitted.
Exactly. I think that asking "what repos have you cloned just so that you could look at something, not intending on actually building or using that particular code" is probably roughly analogous to asking "what Wikipedia pages have you read recently" I frequently do both of those for the same reasons. I might pull up the wikipedia page for the Apollo Lunar Module because I suddenly realize that I don't know how the R…
You just made me realize that github needs better search. I like the presentation on github but, without git grep, I just pull it local and read from there.
Example: https://github.com/django/django/search?q=modelchoicefield&t...
Re: Code is not Literature
#66I think the author has a somewhat limited definition of “literature”, though he ultimately comes to the right conclusion that code must be “studied”, not “read”. It’s true, code is typically less linear than a pulp novel, but other types of literature are also involved, with layered meanings, which must be examined carefully, with reference material handy, and lots of flipping back and forth between sections. For ins…
Re: Code is not Literature
#67I think the author has a somewhat limited definition of “literature”, though he ultimately comes to the right conclusion that code must be “studied”, not “read”. It’s true, code is typically less linear than a pulp novel, but other types of literature are also involved, with layered meanings, which must be examined carefully, with reference material handy, and lots of flipping back and forth between sections. For ins…
You summarize very well exactly what I felt from the article. I sometimes feel the metaphor goes the other way, that is, when I seriously read a literature (in my case, it's often a play) I feel like I'm "decoding" it.
Re: Code is not Literature
#68Re: Code is not Literature
#69I think the author has a somewhat limited definition of “literature”, though he ultimately comes to the right conclusion that code must be “studied”, not “read”. It’s true, code is typically less linear than a pulp novel, but other types of literature are also involved, with layered meanings, which must be examined carefully, with reference material handy, and lots of flipping back and forth between sections. For ins…
Personally, I have to use the skills I gained learning rhetoric and analyzing literature to make sense of some code bases. I've seen some shocking ball-o-mud code bases, and the only way to make sense of it was to understand the author(s), though never having met them. And to understand the subtext of the syntax, despite inconsistent application (poor naming convention and mixing ladder and structured text is like reading illuminated medieval engravings). There's code smells and slight variation in copy/paste blocks that belie the history of edits. There are threads woven through multiple volumes, where deprecated interlocks and crossed wires lead to bizarre plot twists. It's easy to think of certain machines as having personalities (or mental disorders, as the case may be). And there's never just an atomic dozen lines of code; at best you can reference five subroutines across two PLCs to describe what may be going on. And like good literature, you can't spoil the ending, as the joy is in the retelling of the story (of how you tracked down what was really happening).
It doesn't have to be a fascinating travesty, but I've yet to see a boring, dull, straightforward control system. Perhaps industrial programming logic just naturally turns out that way.
But it sure feels like Moby Dick, both in size, depth, and the unreliable narrator.
Re: Code is not Literature
#70The main problem I see is that code is read left to right, top to bottom (for the most part) but it is rarely, if ever, written that way. The order that decisions are made is almost as important as the decisions themselves. But, we lose almost all of that order or 'context'. Worse, although we can place comments in the code, we cannot attach comments to the evolution of code. Evolutional comments could describe why t…
I guess Google has spoiled me. When reading code, I constantly look at its development history - commit messages, diffs and line-by-line "blame", linked bugs and code review threads. If you have good tools for that, there's much less need for inline comments.