"Reading Code Good" at RailsConf2014

When I asked experienced developers how I can become a better programmer faster, the most common answer I got was "Read Code."

This is a talk I gave at Rails Conf about my journey forming my own Code Club. Check out the slides.

If you're interested in starting your own Code Club, I'm building an app to help you do just that. Sign up and I'll let you know when it's ready.

FAQS

What's a Code Club?

It's like a Book Club, but you read code instead. You can do it remotely (we do it via Google Hangout), or in person. We meet every Sunday at 11AM for one hour of reading.

How do I start my own Code Club?

Great question! First, find some developers to read with. I find it helpful to read with people around my skill level and to keep the group small, about 3 - 5 people. Need help connecting with people? Give a shout @readingcodegood.

Where can I find people to start a Code Club with?

A great place to start is by asking around at local meetups in your area. Organizations focused on learning to program, like Code Crew, Hacker Hours and RailsBridge are also great places to start. If you or your organization are looking to start a Code Club of your own, let us know at @readingcodegood.

What code should I read?

For our group, a code base of about 100 lines (not including gemfiles, config files, specs, etc.) works really well. Any larger, and it becomes too much to get through in an hour. Try a few different sizes in the language you prefer, and see what works for you. To get started, check out the list of Code Bases below. And if you find a different you like, tweet me the link and I'll post it here.

But how do I read it? Should I just read it straight through?

We try to find the main part of the code where most of the action seems to be going on, code usually found in the 'lib' directory, and we read it straight through, generally going line by line. Along the way, we stop a ton for questions, some google searching, discussing things we haven't seen before, calling out patterns we recognize, and testing out new methods as we come across them. And it's in these conversations that the learning really happens.

A different strategy is to start with the specs and find the corresponding code that's being tested. Another is to start with the documentation, and try to find and understand how specific methods work. At the end of the day, these are all just starting points for the real value of Code Club -- the learning that happens in the discussion of the code.

How can I get the most out of Code Club? Any guidelines?

These are great questions you're asking. I'm truly impressed by your inquisitive nature. Here are some guidelines we've used to have some really productive reading sessions.
  1. Be consistent. For us that means every week, for just one hour.
  2. Pick a tour guide. It really helps to have someone leading the session. It doesn't mean they're the expert or that they have all the answers. But having a single person to kick things off, make sure everyone's on the same page, and keep the conversation going is really helpful.
  3. Don't be afraid to digress. Ask lots of questions (How does this method work? Why's that variable called that? What's this module doing here?) and look up the stuff you don't understand along the way. And when you come across something you've never seen before, write some of that code yourself and see what it does! That's the fun part.
  4. It's a team effort. Everyone should feel comfortable stopping the group, asking questions, and exploring. Having a small group of people (3 - 5) helps make sure everyone's engaged and learning.
  5. The code doesn't have to be good. We learn a ton from poorly written code. And it's a great opportunity to try and rewrite some of it to make it better. And maybe even make a pull request *gasp*.
  6. Interact with the code. Reading code is not a passive activity. The literal reading doesn't cut it. Asking questions like "What's the intent of this method?", "Why was it written this way?", and "How does this fit into the overall style and structure of the code base?" are some great starters to making your Code Club session productive and interactive.
  7. Find knowledge gaps. Code Club is a great way to find gaps in your own programming knowledge, whether the gap is in how a method works, a design pattern, or some higher level programming concept. Use your code reading as a place to find and fill those gaps with your group.

This is great, but I have more questions about reading code. What do I do?

No problem! Tweet me either at @saronyitbarek or @readingcodegood and ask away. Till then, happy reading :)

About

"Reading Code Good" is based on a RailsConf talk by Saron. Check out the slides and the video. Saron currently works as a developer for the NY Tech Meetup (yes, this is a real job), runs a weekly TwitterChat for people learning to code, and draws cartoons and such on her blog. Looking to start a #CodeClub? Have a good code base you want to post here? Tell her about it here: @readingcodegood or email her.