As you probably didn’t realize, you spent 2/3 of your time in doing programming tasks by reading your own codes or somebody else’s codes. So you ask why do we spend so much time in reading codes? Because before you do following tasks, you usually have to read and understand of existing codebase first:
- Add features
- Update requirements
- Discuss solution with peers(Code Review)
So you have to be good at code reading skills to be more productive and become better programmers/developers. Then you ask how you could improve your code reading skills? Different people have different styles in learning, so I share what I usually do for myself:
- Pick up an open source project. It could be a library or an application that you already used.
- Try to understand what the project is about.
- Try to put very minimum effort to get a very simple example working.
- Go deeper to see how they implemented classes/modules to provide our simple example working.
- Take notes on good parts(code structures, idioms, tricks, …) while I reading codes.
- Some times I found some questions on why they decided to solve this particular problem in that way? I take note and ask in mailing list or IRC if they have.
Finally, that’s what I would like to share with you, but I forget to mention one more thing, there is a free global code reading study group. This group has just started, and we are mainly focus on Ruby and JS projects right now, but more to follow. Our first week project is Rack gem.