Reviewing Strangers’ Code on Github
Editorial Note: I originally wrote this post for the SmartBear blog. You can check out the original here, at their site. While you’re there, check out some of the pieces by their other authors.
I make part of my living these days as an IT management consultant, and in this capacity, I’ve developed an interesting niche: evaluation of codebases. Specifically, an organization’t management will bring me in to spend a week or two looking through a codebase, sizing it up, and making recommendations for what to do with it going forward (e.g. “stay the course, rework the architecture, targeted training, scrap it, etc.”)
As you might imagine, this part of my practice leads me to looking at and quickly grokking a lot of unfamiliar code. Every few weeks, I’m squinting at strange classes, running static analysis tools, and making lists of assumptions and questions to ask the development team. And I’ve found that this practice has benefits to me beyond helping me earn my living. I’d argue that it makes me a better programmer.
Consider the opposite situation — one that describes an enormous cross section of industry developers. They come in to work each day and deal with the same codebase. This continues day in and day out for weeks, months, or even years.
This year, my wife and I are hoping to make a visit to the Galapagos Islands, which are noteworthy for the uniqueness of the wildlife there. The animals living there have been isolated from the wider world of fauna for millions of years, and the result is that they’ve developed unique and unusual characteristics that cannot be found anywhere else. This is what tends to happen to codebases in shops where the majority of developers work in relative isolation. A bubble forms, and practices drift toward the unusual.
For an individual, this isolation tends to put a damper on skill acquisition and can even be career limiting. It’s the polar opposite of the situation in which I find myself — constantly immersed in unfamiliar code. So how can you remedy the isolation if your professional life shows you the same code in day in and day out? (Without drastic career moves, that is). Well, the dead simplest thing I can think of is to seek out and review other people’s code. And to do that, there’s no better place to go than Github.
Here’s what you can do. Every few weeks or so, poke around idly on Github, searching for random codebases in your language of choice. Big or small, popular or niche, active or forgotten — it really doesn’t matter much. They just need to be different and new.
Once you’ve found one (and just about any one will do), clone it and get the code locally on your machine. Open it up in your IDE/editor/environment of choice, and start looking around. If you start to perform this exercise with some regularity, here are some benefits that you can expect, in my experience.