by eterevsky · 3y ago · 0 comments
That said, I personally DO read code. Besides code reviews that were mentioned in the article I read the code that my code depend on. Especially when I want to better understand some API, I read not only the headers, but the actual implementations of the functions that I'm using.
Sometimes I read code to better understand some algorithm. I only understood how Transformer architecture worked when I read some of its implementations.
So yeah, reading code is cool. We just don't read it as we read books.
Well, one has to start reading from somewhere, and the start seems like a good way to start, is it not? Well, actually, no, it's not, because you have to waddle from main through like ten levels of procedure calls until some actual work starts being performed, but if you don't know where exactly the interesting parts are the only other options are either try to grep (doesn't work reliably in repositories where the authors like short and cryptic names) or to read source files until you find the relevant place.
> It would be something like reading an encyclopedia starting from the letter A.
I actually did something similar as a child, except I'd just open it on a random page and start reading. There is nothing really wrong with that as a recreational reading IMHO.
When tabbed browsing came around it was a relief, the browser did all that for me well enough. Unsurprisingly I frequently find out how many tabs is too many for my current computer (less frequently than 20 yeas ago tho since browsers and computers are a lot better than they used to be.)
Yeah, but I think that this is beside the point since the encyclopedia isn't colloquially literature, either.
But it's not a continuous reading of code. I don't read the code of my dependency from start to finish.
I think perhaps this is not even a valid concept...
The simple case of a program with a main maybe has a "start"? (Although due to program loading, there is quite a lot of code that executes before main, often not your code but sometimes static initialization, e.g.).
In the case of async programming (queues, services, interrupt handlers, etc.), a "start" is pretty arbitrary, and needs to be defined some other way (start of a data scenario e.g.)...
And in all sceanrios except pure batch processing, a "finish" doesn't exist, except in the sense of a "quit" or termination scenario, but not in relation to rest of the code base...