Answer the question
In order to leave comments, you need to log in
Code with comments - redundancy?
Got a job for the first time. The company has many years of experience and the same experienced employees. Many projects in different languages, both new and old. I was imprisoned for a couple of such projects, given tasks for it and had a short excursion into each of them (what it is for and what it does). As soon as I started doing this very task, I ran into an obstacle - code without comments. No, it is understandable and concise, but, say, in order to understand why this or that class is needed, you need to look at its methods and properties. the inheritance of its classes (this is python - there is a place for multiple inheritance) to remember and analyze and after 5-10 minutes only understand what this class is for. Although sometimes this is not necessary at all, sometimes you just need to know abstractly about this class - what it serves for, why it is needed and what it does. Everything, nothing more is needed. Further, it's worse. The project is a framework with a bunch of mixins and classes, you need to be able to manage and use them correctly. And now imagine that there are a lot of such classes and it takes about 5-10 minutes to understand each of them, plus meager human capabilities go, that is, remembering all this is unrealistic. After 40 minutes of such yaw, you quickly get tired and your performance drops, respectively, no performance.
There is an option - to ask colleagues, but, firstly, there are a lot of questions and I don’t want to distract, and secondly, I don’t want to seem completely stupid (sometimes it seems to me, sometimes it takes me an hour to understand some detail, looking for in the class hierarchy the answer to the question, and here comes a more experienced programmer explaining all this in 15 seconds ...)
So what is it? My lack of experience? Is commenting code irrelevant?
Answer the question
In order to leave comments, you need to log in
No, this is corporate shit code.
Comments should contain up-to-date information why this code was written.
Commenting is relevant when a piece of code, for example, bypasses some kind of framework or runtime bug. Preferably with a link to the ticket.
If the name of a class, method, or variable says nothing about its purpose, then the problem is clearly not the lack of comments.
I had to cut out a small self-written class that implements signals. Changed it to Observable. Comments did not help in any way, because. it is impossible to verify their validity. This is where tests can help.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question