Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

How can I read and understand codes faster?

This 4 step process is simple and will save you a lot of time and effort; all you need to do is: Run the code and explore the results. Find the main function or the start point of the code. Run the code under the debugger and fully understand the code's mechanics.

Why is it harder to read code than to write?

The first reason code is harder to read than to write has to do with the sheer amount of data you need to keep in your head in order to read code. When you write code, you only need to remember the variables, algorithms, data, etc. relevant to the feature your are currently writing.


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.


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.


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.


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.