Third party source code study

Apart from careful and diligent reading, what are the best workflow and tool to study and understand the source code of a third party application or library (mainly Ruby, for example, in order to adapt a Ruby library to Crystal)?

What would seem to me to be the most suitable would be a graph (graphviz type) representing the relationships between method calls (possibly limited to only the methods of the library or application to avoid complexity)

Thanks for advices

Maybe I’m old fashioned but a debugger and some elbow grease will probably do you better than any graph ever would.

1 Like

Loose reading? I’d just follow the code in order to get a picture of how it’s doing its thing. But I hate diagrams, I prefer to read the code.

Use language server (e.g. crystalline) in your editor, and use the “go to definition”, and “go to references” functionality.

From my point of view:

  1. You have to study and understand the source code of a third party ruby application or library, at least partially.

  2. Refactor the ruby project as much as possible make it more Crystal way. you have to use some external tools, e.g. rubocop, the key is, it must be still workable as a ruby program.

Now, if you done this, probably a graph is in your heat.

  1. adapt it.