One of the first things you learn when you introduce yourself to a programming language is how to use comments. Comments are widely used in programming, mainly because programming languages are not as expressive as human languages.
Naturally, developers can not remember every piece of code they have written, especially the code they have written a long time ago. Apart from that, every time you look at other people's work, you are missing the implementation details, so it is hard to understand what were the intentions of the author. As a result, developers often spend a lot of time trying to evaluate the code they are looking at.
The easiest and most obvious solution to the problem is to use comments. It is convenient to leave some quick notes for your co-workers or for your future self, which can later help you understand what is going on. That is why comments are so popular and developers tend to overuse them.
So, are comments really a problem, someone might ask?
In my opinion, it depends on the circumstances and the frequency of their usage. Having a few notes here and there, never hurt anybody. In fact, they might be very helpful, saving you and your colleagues a lot of time. Assuming that your codebase is small and stable, without frequent changes, you don't have many reasons to avoid using comments.
But that is usually not the case, typically, developers work on thousands of lines of code, in teams and with strict deadlines. The requirements change constantly so the code changes are often too.
Under these conditions, developers add, delete and move code all the time. It is very easy to forget to update the comments as their value is only semantic and they do not have an impact on the execution of the program.
How many times have you stumbled upon comments that are clearly not in the right place and don’t make any sense? In the past, this might have been a valid and useful comment. But after multiple changes in the code, the comment got obsolete and misleading. The term “Lying comments” is usually used to describe those types of comments.
The truth is that there is nothing that prevents you from maintaining the comments alongside your code. It just requires more effort but I think that not many people are willing to spend their time fixing comments.