JSJ 408: Reading Source Code with Carl Mungazi
Carl Mungazi is a frontend developer at Limejump in London. He is a former journalist and switched to programming in 2016. Today the panel is discussing the benefits of reading source code. Carl began reading source code because he came into programming late and from a different field. His first project was with Mithril, and he read the source code and documentation to help him understand it. The panelists discuss how reading the source code has helped them and others to improve their coding. They compare reading and understanding source code to learning a foreign language, and discuss different methods.
Carl gives some suggestions for reading source code effectively. He advises people to be patient and step through the code. Accept that you will probably take a wrong path at some point or another, but the more you read, the more you will see patterns in how libraries are structured. He also encourages listeners to approach the authors, as they are often happy to lend a hand. Reading source code is an active approach of stepping through, debugging, putting in break points, checking the stack, and so forth. It’s also important to do outside research.
Carl talks more about his debugging process. He still relies on a debugger, but reading a library helps you to see patterns and guess the output of a function. These patterns persist in other libraries as well. Once you can guess correctly what will happen, you go back to reading the code and find instances where the output is unexpected, and fix it. Carl’s closing thoughts are that through reading source code, he has learned that although code is used differently in each library, they are all written in the same language, and therefore interrelated. This gave him more confidence in reading code because they’re all fundamentally the same. When a bug is discovered, he encourages listeners to look at the source code before googling a solution.
- AJ O’Neal
- Dan Shapir
- Steve Edwards
- Charles Max Wood
- Carl Mungazi
"The MaxCoders Guide to Finding Your Dream Developer Job" by Charles Max Wood will be out on November 20th on Amazon. Get your copy on that date only for $2.99.
Charles Max Wood
How did Carl get started in programming?
Carl was a journalist before he was a programmer. His first project was with Mithril. He read the Mithril source code to better understand what he was doing.
What are the benefits of reading source code?
It helps you really understand how your code works. Reading source code helps you see patterns in the code, which in turns helps you identify and fix bugs.
How can I read source code effectively?
Be patient and step through the code. Accept that you will probably take a wrong path at some point or another, but the more you read, the more you will see patterns in how libraries are structured.
How are different libraries related?
Although code is used differently in each library, they are all written in the same language, and therefore interrelated. Therefore, have confidence when reading code because they’re all fundamentally the same.