4 ms·
Yes. (As in both: yes I agree with your way of getting to know a codebase, and yes you misunderstand what at least some people mean by "read code".) See the "Co
by svat 3y ago
Yes. (As in both: yes I agree with your way of getting to know a codebase, and yes you misunderstand what at least some people mean by "read code".) See the "Code Is Not Literature" 2014 blog post that was discussed here last week (https://news.ycombinator.com/item?id=37134520 https://news.ycombinator.com/item?id=37134520), and the 2018 blog post that I linked to as concrete detail (https://news.ycombinator.com/item?id=37138832 https://news.ycombinator.com/item?id=37138832). Quoting Seibel quoting Knuth:
> > I got a copy of the source-code listing for it. I didn’t have a manual for the machine, so I wasn’t even sure what the machine language was. […] It was just basically the way you solve some kind of an unknown puzzle—make tables and charts and get a little more information here and make a hypothesis. In general when I’m reading a technical paper, it’s the same challenge. I’m trying to get into the author’s mind, trying to figure out what the concept is. The more you learn to read other people’s stuff, the more able you are to invent your own in the future, it seems to me.
> He’s not describing reading literature; he’s describing a scientific investigation.
So when people like Knuth talk about “reading code”, or even reading papers or books!, they're already describing a process like what you described, not reading linearly.
Even for his “literate program” TeX, you can see (https://www.youtube.com/playlist?list=PL5B7B2302476634D5 https://www.youtube.com/playlist?list=PL5B7B2302476634D5 1:08:25 in session 4) that he recommends reading it that way:
> Start at the beginning, read some of these comments and familiarize yourself with use of the index, and then set yourself some problem or other. […] If you take any one of TeX’s primitives like “def” or something like that, you can look it up in the index under that name and it will say “def primitive” and it will refer you to the place where it was put in the hash table and that will refer you to what command code it has and you might be able to trace through looking at the index [the] whole history of def, how it comes through TeX. If you don’t like that problem, give yourself some other little task, saying “I wonder what this does” and that will just give you a reason for perusing the index and finding your way through the report… the main thing to do is just to get a little familiar with the notation and mess up the page—get the page a little black on the edges.
- jrmg 3y agoThis is a great reply - thanks. I think this bolsters my sense that we should not be calling this activity ‘reading’ but rather ‘investigating’ or ‘researching’ or ‘understanding’ or something (none of these are perfect - there must be a better word…) Calling it ‘reading’ - especially if encouraging newcomers to programming to do it - is, I think, likely to discourage more than help.
- parms 3y ago"grokking"
- svat 3y agoI guess “studying” would be a good word: it's close enough to “reading”, while also having an educational connotation and no expectation of being a linear process. Although I'd encourage everyone to consider “reading” already as non-linear: see e.g. https://www.cs.cmu.edu/~mblum/research/pdf/grad.html https://www.cs.cmu.edu/~mblum/research/pdf/grad.html : > READING: Books are not scrolls. Scrolls must be read like the Torah from one end to the other. Books are random access -- a great innovation over scrolls. Make use of this innovation! Do NOT feel obliged to read a book from beginning to end.
- europeanNyan 3y agoI tried that once and was really perplexed as how Gandalf found the time to wash his robe in the middle of such an important quest.