5 ms·
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.
by ef4 13y ago
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 the "nobody actually reads code" claim. It's a strawman. When I tell people to read code, it's always in the context of "pick something you want to understand or fix, and read with that purpose in mind." Not "the Linux kernel is like Moby Dick, you should really read it all."
- Crito 13y agoExactly. 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 RCS thrusters on it work, or I might clone git's repo because I suddenly realize that I don't know how git-notes is implemented. In either case, I don't read the whole thing (and certainly not straight through in a linear manner, like I read Moby Dick), but rather I'm going to grep/ctrl-f to the part that I'm interested in, then probably jump around a dozen or more times until I am satisfied. That's still reading though.
- spinlock 13y agoYou 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.
- lukeschlather 13y agoWhere I work we have a well-maintained OpenGrok instance which works great. I still end up pulling down the repo and using grep 90% of the time. OpenGrok is what I use when I don't even know which repo I'm interested in.
- gatehouse 13y agoIt is possible to search for a string within a repo but it isn't a grep replacement. Example: https://github.com/django/django/search?q=modelchoicefield&type=Code https://github.com/django/django/search?q=modelchoicefield&t...
- girvo 13y agoYes I agree. But, for myself, even (or especially) with a purpose I mind, I decode, not read per se. I've recently been working through the selfoss source and adding some new features, and this is the tack I've taken through it -- decode the source to find where the feature should be added. So I agree with you, and the OP.
- ef4 13y agoTrue, but that's just a question of density. There are books written in English that are so dense that they too need to be decoded.
- ergusto 13y agoIt does happen. I've been reading jQuery source recently as a learning exercise, for instance.
- jasallen 13y agogratuitous "I agree" post :-)
- jeffdavis 13y agoAgreed. It's more like dense technical writing than literature. That doesn't mean that reading it is any less important, or that writing readable code is any less important, or that code is all an ugly mess not worth reading. It may mean that the reading pattern for code might not lend itself toward a reading group in the same way that literature does. So we might need to either spend more time reading code in solitude or develop new ways to do reading groups that work for this style of writing. And it just seems plain ridiculous to say that people don't spend time reading code. People do read code, but they don't think about it as "reading" in the same way as someone reads a book, so they don't have it readily at hand when asked.
- joe_the_user 13y agoI think the claim is "nobody reads code the way they read literature", which isn't a strawman in the context he's writing.
- dllthomas 13y agoI recently read Knuth's "Literate Programming" essay, which is a woven source file.