Learning to read the source code of Online Python Tutor

by Security Dude

Today I learned about the term “Yak Shaving”. So the bigger question I have is “How do you read source code?” Where do you start?

Yesterday, the author of OPT visited Hacker School. With his help I now have the source code of OPT sitting on my laptop hard drive. Looking at source code is overwhelming. I see things that I don’t understand. I’m a visual person, and I still like putting pen to paper. So, I open the first few interesting files on my hard drive. I started looking at the imports. The def statements. The class statements. I end up write it out.

After I wrote it out, I thought maybe I should work on the files electronically. I went through my first 1000 lines of code and stripped out all the details to reveal the high level structure.

You can see that I’ve build a Table of Contents for the generate_json_trace.py file and the associated pg_logger.py file.

Here I’m using pdb. I’m going to start stepping through the code with assumptions on what’s happening in the code. I will let you know how it goes.

Advertisements