- 2
Does Use of comments in c valuable????? 😞
I don't want to learn them.
4 ответов
+ 4
You don't learn comments lol? They aren't necessary but imagine you yourself were working on a big project and got busy suddenly and came back after weeks or months ,it would be really difficult to pick up on what you did unless you structured it well ,also if someone else will work on your project ,he might find it difficult to understand things as well ,
+ 1
???
0
In my opinion you should use comments sparingly. It's better to have code that is self-explanatory with descriptive variables and function names. If you need to comment on your code for it to be understandable, then that time is probably better spent cleaning up the code and refactoring it.
Remember, comments rot! Not only do they clutter up the source and make it hard to follow, but they can also mislead you. It's easy for code to change and for comments to be left behind. If you have a lot of comments in your source it's probably easier to miss that they no longer describe what your code is doing and misleading comments can be a source for bugs on their own.
Comments (if they're needed) should describe why your code is necessary and not explain line by line what the code is doing. They can also be useful to describe if you're not doing something by-the-book. Otherwise they're better off avoided.
Every time you add a comment you must remember the extra maintenance cost of having to maintain not just the code, but the comments that go with it.
0
comments are just plain English, not code, so you can easily understand others program without seeing the output if they tag along the comments with the code!