As a new programmer, everyone tells you to build. But just as important is reading. Reading code is a powerful exercise - dissecting the source code of gems and libraries used in Rails offers the opportunity to examine patterns and design choices, while building confidence in new developers. But good code reading isn’t as simple as scanning the source. The concrete guidelines outlined in this talk can maximize the benefits of your future code reading sessions and help you grow as a developer.
The code reading group I organize meets every Sunday morning to dive into a fresh, new codebase. We do it because we are new programmers, and we wanted to strengthen our skills and be exposed to different styles. And so far, it’s been incredibly helpful. We’re regularly exposed to new designs and finding different ways to express ourselves through code.
But we’re also discovering patterns we didn’t realize were patterns. We’re finding interesting applications and programs that benefit Rails apps that we hadn’t thought or heard of before. And as new programmers, we’ve found that it’s tremendously helped our confidence in reading and working with unfamiliar code bases on both personal projects and at work.
I want to discuss these benefits, and talk about how to start, and most importantly, get in the habit of, reading code. In speaking to different people who have conducted their own code reading groups as well as having tried a few different approaches with my own group, there are a few guidelines I’ve found essential in a successful code reading session.
The success of a good code reading session requires a small group (no more than five people) who are roughly at the same programming level. I’ve found the quality of the code base itself to be crucial, both in design and in personal applicability. We got much more out of the gems we were genuinely interested in than we did from the gems that we could see no use for in our own projects. I’ve read articles discussing reading code as literature, and I want to discuss our approach to reading code as solving a mystery -- we are comfortable going down rabbit holes, breaking out irb to test out a new method, or googling a term we’d never heard of before. This exploratory approach to reading code has been a key part of the group’s success, as well as a great habit to develop as a new programmer.
At the same time, there are things that should be avoided. One of the worst pieces of advice I received on starting a code reading group was to read Active Record. We learned the hard way to start very small, with code bases of 100 lines, and then slowly loosen that requirement as we grew more comfortable. Not going after the bigger and more popular gems is important as a novice.
For the flow of my talk, I’d like to start by discussing the general benefits of code reading, how it’s particularly helpful as a new Rails dev, dive into the details of how to conduct an effective code reading session, and end by providing solid steps on how to start a code reading group of your own. I hope the audience leaves empowered and excited to read code good.
This talk is particularly applicable to new programmers and helps novices leverage the accessibility of open source software to grow. When you’re a new programmer, everyone always tells you to build. But reading is just as important. It gives you an opportunity to learn, reflect, and grow.
I organize a code reading group. Every Sunday for an hour, we pick a ruby code base to read, dissect, and play with. We try to find small gems and libraries -- things we can digest in an hour -- and try to find code bases that had a respectable number of downloads.
As a recent code newbie, I’ve been pushing to grow and learn as much and as fast as I can. I discovered programming after graduating college, and I understand the immediate hurdles of my intended audience of new programmers, and am actively working to find ways to make it easier for newbies to grow and develop. The code reading club is one of the ways I’ve found most effective and easy to execute on a regular basis. As new programers look for ways to develop and grow, I hope you give me the opportunity to share one powerful way -- by reading code good.