How to improve your reading and understanding of code? [closed]

Solution 1:

The thing that's helped me, more than anything else, has been refactoring.

Take a project (this can be a work project, personal project, open source project, whatever), and start refactoring.

Over time, the more you refactor other people's code, the better you'll "get into their head" and understand their way of thinking, whether good or bad.

Solution 2:

i personally believe in the

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." -Martin Fowler

so my approach would be to find that person and blow his head off so s/he doesn't spead this virus.

Solution 3:

The things that's helped me, more than anything else, has been testing and refactoring. You cannot say: "I understand this code" until you know how to break it with a test.

Solution 4:

Don't just read open-source code, join one. This way you can ask "why was it written this way" vs. just simply reading it. More often than not, there was an underlying reason for doing something abnormal, be it authentic or not.

Also, if you are actively involved, you will be able to see the progression of the codebase. You'll become familiar with the style of development from different people. This may provide different avenues for your brain to walk through when you encounter a non-affiliated project that you need to read through.