Code reading
Being good at reading code is the most important skill you can have as a developer. This sounds counterintuitive, but as project grows you spend most of your time reading other people's code. Or the code your wrote more than 6 month ago, which basically counts a code written by another person.
If you are used to code reading and can easily navigate through big codebases, then allocating time to code reading practice might give you very little added value. But if you are in a new ecosystem or don't have much experience — it's a really good use of your time.
When I was starting out with Rails, everything was easy. But
ActiveRecord
magic wasn't very straightforward and confused me. I
spent several days reading the source and adding
print
statements.
It helped my understanding of how things work, but it wasn't the only thing. My code changed. After I've seen how things should work I started writing more SOLID code. And the more code I read the easier it gets.
Good place to start is your dependencies. Or projects that use the same stack us you do. But dependencies can be quite big and hard to attack. Additionally most of the projects are proprietary.
It helps to allocate time just for reading source code and studying how it works. Deliberate practice is the fastest way of acquiring new skill. Occasional yak shaving won't do. But in the end you should be able to shave your yaks much faster.
I compiled a list of projects in different languages that are nice codebases to read. I aimed to pick codebases that are relatively small, but received some positive feedback for code quality from few different sources.
Language | Repo |
---|---|
C |
Redis |
C |
http |
Ruby |
Sinatra |
Lisp |
Old Hacker new source |
Haskell |
Xmonad |
Javascript |
D3 |
Java |
okHttp |
So allocate some time on next weekend, grab source and start reading some good code. This is a not a fresh idea, see prior: Learn to Read the Source, Luke