The Value of Reading Code
Here at Highgroove, we do code reviews, which ensures everyone is reading some code on a regular basis. However, being a developer usually means you’ll be reading code regularly anyway. In the past, I used to avoid this if I could. However, now I’ve learned how much I can get from it, and use it to improve myself as a developer.
Reading code isn’t easy, and I certainly didn’t want to do it when my only goal was figuring out why a gem wasn’t doing what it promised. It was much easier to just find someone familiar with it and pick their brain. However, there’s more to be gained from reading source code than you may think.
Recently, I had project which relied heavily upon Resque. While working on this project, I had a multitude of questions about Resque and how to achieve different things using it. I dug into the source code, and not only found the answer to all my questions, but learned quite a bit.
By taking a hard look at a system I was completely unfamiliar with, I was forced to think about the general requirements for a background worker library, and was able to see how Chris Wanstrath & contributors worked within them. I also gained familiarity with something that my project was going to be interacting with regularly. On top of that, I also found a few Ruby snippets that I really liked, and not only made a note of, but also was able to use on different projects.
I’ve long mastered enough Google-fu to get me out of a jam when I have an issue with a random gem. However, sometimes The Googles aren’t enough, and I used to dread having to roll up my sleeves and start digging into the gem source code. Now that I’ve grown used to reading code, I look at it as an opportunity to look at someone else’s programming style, and hopefully learn a thing or two.
What about you? Do you hate reading code, accept it as part of being a developer, or have you learned to love it?