NISHIO Hirokazu[Translate]
(1.3.3.2) Reading source code roughly
When reading the source code, I recommend starting roughly and gradually detailed. The book "Complete explanation of Ruby source code" (*20) has a section "Introduction to source code reading" in the introduction. It says not to read the contents of a function from the beginning but to read roughly and gradually detailed as follows. (*21)

Read a document describing the internal structure if any
Read directory structure
Read file structure
Research abbreviations
Know the data structure
Understand the calling relationship between functions
Read function

In the case of books, the documents describing the internal structure are sometimes a part of the foreword. For this book, it is (0.3) Structure of this book.

The directory structure and the file structure corresponds to chapters and sections in books. After that, you investigate the abbreviations *22, the structure of the data shared between the functions, the relation between the functions, and finally read the detailed implementation of the function.

---

Footnotes:

*20: Aoki Mineo / supervised by Yukihiro Matsumoto (Matz) "Complete explanation of Ruby source code" Impress, 2002. You can read all the chapters of the book on the web page. http://i.loveruby.net/en/rhg/book/

*21: This step is called "static analysis." Before that, we have "make purpose concrete" and "dynamic analysis." The concretization of purpose is the same as the contents of the previous section (1.3.2) Requirement for learning from what you want to know > (1.3.2.1) achievement conditions are clear. "Dynamic analysis" is an approach that observes the behavior of the program. It is a unique process of reading the source code. Related column is (Column) Reading along time series.

*22 Abbreviations are frequent concepts, and they are abbreviated because the author do not want to write every time. Those who use abbreviations know the meaning of abbreviations. And they implicitly assume that the readers also understand the meaning of abbreviations. For example, they think that "if I write GC, anyone understand it stand for Garbage Collection." Even If they notice the possibility that someone does not know it, they write a single line "GC stands for Garbage Collection" somewhere in the document. No one explains the meaning of abbreviation at every occurrence. If you do not understand the meaning of abbreviations, it is vital to know the meaning first.

en
[<<< Previous:(1.3.3.1) Even the material has more than 1,000 pages, the table of contents is only 6 pages] [Next: (1.3.3.3) Rough structure of documents >>>]

Engineer's way of creating knowledge > (1) How to learn > (1.3) Three methods of information gathering > (1.3.3) Learn roughly first > (1.3.3.2) Reading source code roughly

"Engineer's way of creating knowledge" the English version of my book is now available on [Engineer's way of creating knowledge]

(C)NISHIO Hirokazu / Converted from [Scrapbox] at [Edit]