A computer language is not just a way of getting a computer to perform operations but rather that it is a novel formal medium for expressing ideas about methodology. Thus, programs must be written for people to read, and only incidentally for machines to execute.
The acts of the mind [...] are chiefly these three: 1. Combining several simple ideas into one compound one, and thus all complex ideas are made. 2. The second is bringing two ideas together [...] to take a view of them at once, without uniting them into one, by which it gets all its ideas of relations. 3. The third is separating them from all other ideas that accompany them in their real existence: this is called abstraction, and thus all its general ideas are made. John Locke, An Essay Concerning Human Understanding (1690)
You probably will not read the code: - If you encounter no problems using the library - If the documentation is clear and abundant - If library has no bugs Does this mean you do not need to read the code?
• Intellectual curiosity • Understanding how software we write really works • Understanding how large applications are written • Benefiting from the experience of other programmers • Learning the language better • Leaky Abstractions • Coding is mostly reading and maintenance • We already read our coworkers and previous self's codes all the time
"I. The first reading can be called structural or analytic. Here the reader proceeds from the whole to its parts. II. The second reading can be called interpretative or synthetic. Here the reader proceeds from the parts to the whole. III. The third reading can be called critical or evaluative. Here the reader judges the author, and decides whether he agrees or disagrees. " From How to Read a Book by Adler
• Code is not linear, where do we start? • There is no argument, it either works or not • There is no single author • Some parts are legacy or for backwards compatibility Differences from Reading a Book
Structural Stage • Understand the hierarchy and skeleton of files • Directory level • Dependency level • Try to understand the main purpose of the library and key points • Try to go through the build process and see how pieces fit
Tools for This Stage • Documentation and experimentation • Look at the directory structure • Look at the dependencies • Find the super nodes: most depended files • Try to find largest and most complex files
Level 2: Diving Down • Getting into source code • Static reading • Lots and lots of searching , grepping and ack'ing and even better ag'ing! • Which file uses which? • Which file is used by which? • Tooling support
Level 2: Diving Down • Dynamic reading from the browser • Experimentation with variables in the browser • Running and reading the tests • Reading advanced documentation
• Some Critique From Community • Cycle.js: Honestly Reactive • Rx decouples data production from data consumption. Apps in Cycle have nothing comparable to imperative calls such as setState(), forceUpdate(), replaceProps(), handleClick()