How to learn to read someone else's code

Suppose from such an exercise your eyelids are gradually getting heavier, and ... You have to wake up from the need to understand someone else's code and put it in order. In my opinion, visually scanning hieroglyphs is not as difficult as it might seem at first. Be that as it may, it is necessary to be able to read someone else's code and edit, and one process does not exist without the second.

Understanding this comes during grueling workouts. We remember especially well when we encounter our mistakes many times due to the lack of proper reading skills of other people's code.

Speaking about the likelihood of errors, we note that in old, a thousand times designed files there are fewer. Usually we see a lot of errors in files that we never changed.

Before reconstructing the code, it is sometimes easier to bring it into an order convenient for you and then make small changes than write styles or events first and then change the layout, for example.

It is better not to leave draft options in the working files, as you will forget about something.

When a team is working on a project, it becomes necessary to first take care of understanding the concept of a future service. You will definitely remember this advice when you notice that you worked productively without returning to questions about how it should be. Each specialist knows his work, and do not be mistaken in the fact that someone has the same idea about how the task will be realized and that it will coincide with yours. Therefore, do not be afraid to consult with colleagues in the shop so that the consequences do not go beyond your control and come as a surprise.

If you are doing a second search for something that again took a decent amount of time, you need to pay attention to it.

Perform an analysis - what you most often had to re-encounter; what kind of elements are you looking for a long time and why. Perhaps this is due to the fact that you would have written a certain piece of code differently, or the logic is not completely clear. In any case, we must act on the basis of the realization that working with the code is your task, and not the one who wrote it first.

Working with other people's files, we begin to understand what the person wanted, as he saw the future service. The course of encoded thoughts becomes more logical for us, and sometimes even the most correct for the implementation of a specific task.

Many tasks are waiting for you on the Internet, and their search does not take as much time as it might seem at first.

It's nice to take advantage of the usual notebooks. For example, CTRL + G (search by line number) and other amenities, which significantly saves time.

When working with the code, it is desirable to leave comments. Over time, they will acquire a concise form and will be placed in the right place. This facilitates the work not only for you, but also for other colleagues.
Around the middle of the work on changing the code for a little offload, you can view it for syntax errors.

It is also recommended to edit files in small parts, and start with the most difficult. If you are stuck for a long time at some point - switch to something else. Return to the difficulty tomorrow, in the morning, so as not to spend a lot of time restoring the last thoughts in your memory.

I have no doubt that often you have a stream of thoughts about what needs to be fixed in different parts of the code. To do this, it’s better to write everything down. At the end of the day it will be a good help. It’s easier to calculate the time required to complete the task, and also come in handy for reporting.

When you leave for a break or home, see what else needs to be done. When there is no code in front of you and the task "hangs" in your memory, you will notice the appearance of fresh original thoughts, even if you do not intentionally think about a solution. Especially this technique is suitable for complex tasks. Not to mention trifles, of course.

Also popular now: