T
T
TanakaKuma2019-10-05 16:10:34
Programming
TanakaKuma, 2019-10-05 16:10:34

How to parse someone else's code?

I want to make a small video player for mkv files. I found a library on github for working with the format. There is almost no documentation, only theory about the structure of the format and examples for reading informational headers. To read the necessary data, I did not find it. I tried to get into the VLC code to see examples, but I realized that without knowing how the library itself works, I won’t go far. Therefore, I want to ask knowledgeable people how to deal with situations when, having only the source code of the library on hand, understand how it works? I've searched for information on this topic both here and on other forums, but all the answers assume that I'm already quite familiar with all the components of the code.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Inviz Custos, 2019-10-05
@TanakaKuma

How to parse someone else's code?

Welcome to the real world ;)
But seriously, there is no specific universal algorithm that will help parse the code. Everything is purely individual. You will have to bit by bit restore the train of thought of the one who wrote it.
Perhaps I have not discovered anything new for you, but as it is.
#offtop
Source codes are even more luxury) Some people successfully rewrite applications with only compiled binary without debugging information)

A
ApeCoder, 2019-10-05
@ApeCoder

How do you navigate someone else's code?

A
Anton R., 2019-10-05
@anton_reut

Probably it will sound strange but I read some code "from right to left", or from the end to the beginning (PHP), seriously, sometimes it's clearer for some reason.

M
mayton2019, 2019-10-05
@mayton2019

In 99% of cases, programmers are users of someone else's code. And for this they do not need to dive into the implementation. For good, you need to understand the purpose of the library. Its API. And see the unit test cases as it is tested. There will be an obvious application.
Therefore, the author does not need to parse the code. Moreover, for modern projects, the code has exceeded hundreds of megabytes (for a minute, War and Peace takes barely 5 megabytes) and it is pointless to study it all.
Specifically, the mkv format. This is an analogue of xml only binary. It doesn't need to be cracked or broken or reverse engineered. This is a completely open format. Its specification has been published. And reading it will give more benefit than picking the code. You will understand the spec - and it will immediately be clear what the code does.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question