Open source software is a way of life for developers these days. It would be almost impossible to write a modern day application without using at least some third-party open source tool or library. With all this code getting pulled into your application, it is incredibly important to learn how to read other people’s code. The ability to quickly understand and follow the inner workings of a third party library will make you extremely productive as a developer.
Incomplete Documentation
When was the last time you used a software library where the documentation was 100% correct and up to date?
Tick…tick…tick…
You couldn’t think of a time either? Nearly every actively maintained open source project has gaps in its documentation. Sometimes it’s an oversight, sometimes the rate of commits outpaces the ability to write the documentation.
If you can read the code and understand what’s going on, you have the most up to date documentation possible: the code itself. With the code base in hand, you’ll be all set to:
- Figure out what that undocumented method does
- Find that configuration option that you suspected was there, but wasn’t documented.
- Discover what logging can be enabled to help you debug an issue
Over the years, I’ve found a gold mine of information about the various libraries I’ve used, just by reading through the code and using the debugger to follow the flow of execution.
Learn Best Practices
Even the most senior of us, myself included, are constantly learning (or should be). Whether you’re new to development or learning a new language, the best way to jump start your education is to learn from those who have gone before. With open source projects, you have thousands of developers to learn from. Each project has something to teach. Learning to read the code will help you learn that lesson much faster. Some of the things I’ve learned from various open source projects are:
- Object oriented design patterns
- The best way to organize a project
- Best practices for naming things
- How to use a language’s idiomatic features
- Unit test examples
Each time I’ve dug into an open source library, I’ve learned something that I carry into my own software. Sometimes, it’s simply a reminder about something that I know I should be doing but have let slip.
Nasty Bugs
Open source is not perfect. Try not to look shocked. Even the best of projects has bugs in it. Someday you’ll get bit by one of those bugs and you’ll have to figure out how to deal with it. If you’re good at reading code, you’ll be better equipped to find the source of the problem and either work around it or fix it (and contribute the patch back to the project).
Use the Source, Luke!
The ability to read code is an underappreciated skill. Many developers flounder when they run into a problem and that problem isn’t addressed by the documentation. They don’t know what to do if the a problem appears to be in an open source library. Getting good at reading third party code is something that will serve you well, long into your career.