The best skill a developer can have is being able to read code well.
Reading and understanding code is the most important skill because you spend most of your time doing it already and you need to understand not only your own code but also others' code.
As Robert C. Martin has famously said "the ratio of time spent reading versus writing is well over 10 to 1". While I completely agree with his observation, Martin uses this fact to recommend making your own code as understandable as possible which I would also agree with too. However even more important is being able to proficiently read code.
You can't write all the code you will use or keep the rest of the world up to your high standard. In order to build anything, make modifications to code or even just discuss it requires understanding others' code. Learning how to understand bad code is the only way through this challenge.
Writing good code only goes so far, you'll still have to read your teammates' code, your framework's and library's code.
How can I get better at reading (bad) code?
Reading code is a muscle that needs to be trained. So far your brain is pretty well trained on reading mostly your own codebase. Like only listening to only one news source, you can fall into limiting yourself in thinking in only one way.
Mixing up what read allows you to get different inputs and see different solutions.
I'd recommend:
- Read how your framework (e.g. React, Vue.js, Rails, etc) is built to understand what you've already got to work with and how you can take advantage of it.
- Read how the libraries you use (e.g. Redux, lodash, Rake) are structured and modularised.
- Read how similar applications are built and how they are solving a lot of the same problems you have in different ways (e.g. Sound-Redux, vue-hackernews).
What codebases would you recommend reading?
Top comments (2)
Thanks Vesa, I completely agree. Understanding the movement and mutation of state is key and getting a view of the big picture. Thanks again